while(<@eachline>){
You are interpolating the array @eachline in a double quoted context and then using the glob function on the resulting string:
$ perl -MO=Deparse -e'while(<@eachline>){}'
use File::Glob ();
while (defined($_ = glob(join($", @eachline)))) {
();
}
-e syntax OK
this is a very obtuse way to split a string on whitespace:
$ perl -le'my @eachline = ( "one two three four\n", "five six seven ei
+ght\n" ); while(<@eachline>){print}'
one
two
three
four
five
six
seven
eight
It looks like you may want something like this:
use strict;
use warnings;
open my $FILEHANDLE, "<", "Action5.c" or die "cannot open < Action5.c:
+ $!";
my %patterns = (
transaction => 0,
find => 0,
think => 0,
save_param => 0,
start_sub => 0,
url => 0,
submit => 0,
);
while ( my $line = <$FILEHANDLE> ) {
for my $pattern ( keys %patterns ) {
$patterns{ $pattern } += () = $line =~ /$pattern/g;
}
}
for my $pattern ( keys %patterns ) {
print "Number of patterns found for".$pattern." is ".$patterns{ $p
+attern }."\n";
}
close $FILEHANDLE;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.