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