I can seem to get the
my $text = do { local $/; <MAT> }; to work. maybe you could advise me further. Here is my complete code.
#! perl
#! usr/bin/local/perl
$file = shift;
$pattern = shift;
open(MAT, "<$file") or die "bad file name";
my $text = do ( local $/: <MAT> );
while($text =~ /\Q$pattern\E/g) {
$x += 1;
}
print "found $x matches\n";
close(MAT);
that crashes on me so here is my code that works but doesn't read the whole file.
#! perl
#! usr/bin/local/perl
$file = shift;
$pattern = shift;
open(MAT, "<$file") or die "bad file name";
$text = <MAT>;
while($text =~ /\Q$pattern\E/g) {
$x += 1;
}
print "found $x matches\n";
close(MAT);
thanks
Height : varies depending on my speed relative to the observer
Weight : is a sensation caused by the gravitational wrapping of time-space
Age : time is only a persistent illusion
|