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