in reply to Re^2: Statistics from a txtfile
in thread Statistics from a txtfile
Hi mbdc566021,
Your code looks like it has just been cobbled together with snippets from various sources. This is OK, but don't be afraid to make changes and experiment with the code to see what happens. Here are a few points:
# this matches each character once $filecontents =~ m/./g; # this version also puts a copy of each match into @characters my @characters = $filecontents =~ m/./g; # this counts the number of elements in @characters my $CharCount = scalar @characters; # to verify your regex is matching correctly # this will print a list of each item counted: for (@characters){ print "$_ \n"; }
Good luck with your assignment.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Statistics from a txtfile
by blazar (Canon) on Jan 02, 2008 at 21:17 UTC | |
by hangon (Deacon) on Jan 03, 2008 at 03:36 UTC |