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