how to I count the occurrences of word 'the' in a file?
open my $fh, '<', 'theFile' or die $!; my $count = 0; while( <$fh> ) { ++$count while m[the]g; } print "'the' appeared $count times in 'theFile'";
how to I extract the numeric values in a () sample code:? $extract =~/^\( (\d.+) \)$/
if( $extract =~/^\( (\d.+) \)$/ ) { print "The number was $1"; } else { print "The regex didn't match"; }
In reply to Re: count the occurrences of particular word in a file and extract number in ()
by BrowserUk
in thread count the occurrences of particular word in a file and extract number in ()
by allison
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |