a2822c
diff --git a/magic/Magdir/c-lang b/magic/Magdir/c-lang
a2822c
index 0665627..fdefa8c 100644
a2822c
--- a/magic/Magdir/c-lang
a2822c
+++ b/magic/Magdir/c-lang
a2822c
@@ -6,26 +6,36 @@
a2822c
 # BCPL
a2822c
 0	search/8192	"libhdr"	BCPL source text
a2822c
 !:mime	text/x-bcpl
a2822c
+!:strength / 2
a2822c
 0	search/8192	"LIBHDR"	BCPL source text
a2822c
 !:mime	text/x-bcpl
a2822c
+!:strength / 2
a2822c
 
a2822c
 # C
a2822c
 0	regex	\^#include	C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^char		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^double		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^extern		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^float		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^struct		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	regex	\^union		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 0	search/8192	main(		C source text
a2822c
 !:mime	text/x-c
a2822c
+!:strength / 2
a2822c
 
a2822c
 # C++
a2822c
 # The strength of these rules is increased so they beat the C rules above
a2822c
diff --git a/magic/Magdir/perl b/magic/Magdir/perl
a2822c
index e11f2ab..b02b2c2 100644
a2822c
--- a/magic/Magdir/perl
a2822c
+++ b/magic/Magdir/perl
a2822c
@@ -28,10 +28,14 @@
a2822c
 # check the first line
a2822c
 0	search/1	package
a2822c
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;	Perl5 module source text
a2822c
+# to be tried before C source
a2822c
+!:strength + 5
a2822c
 # not 'p', check other lines
a2822c
 0	search/1	!p
a2822c
 >0	regex		\^package[\ \t]+[0-9A-Za-z_:]+\ *;
a2822c
 >>0	regex		\^1\ *;|\^(use|sub|my)\ .*[(;{=]	Perl5 module source text
a2822c
+# to be tried before C source
a2822c
+!:strength + 40
a2822c
 
a2822c
 
a2822c