You are not testing whether the open statements worked before continuing on.
Also, what is the point of the for loop? A simple print $data; should suffice since the numbers will all appear on one line once the funky stuff is removed (since you are not printing a <br />). The funky stuff that I mentioned are the curly braces and they are killing the script.
Here's your for loop with the curly braces removed (and a couple mys for good measure):
for ( my $count = 0; $count < length( $data ); $count++ ) { my $number = substr( $data, $count, 1 ); print( $number, "\n" ); }
Here is another way to do that loop (bonus! I added the <br />s):
for my $number (split //, $data) { print "$number<br />\n"; }
Someone is bound to say this if I don't.... You can even do it with a one-liner:
print "$_<br />\n" for (split //, $data);
Update: Rewrote the last sentence in the second paragraph for clarity.
In reply to Re: Perl counter in cgi-bin
by Mr. Muskrat
in thread Perl counter in cgi-bin
by edeita2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |