I only get 13 characters... the test file is simply a file with letters a - z, it should print all characters backwardsdark314@somebox:~/Perl$ ./tac.pl test zyxwvutsrqpon
#!/usr/bin/perl use strict; #perl excercise, reverse cat... my @file; while (<>) { chomp; push @file, $_; } foreach (@file) { my $test = pop (@file); print $test; } print "\n";
Thanks. I am aware of reverse() lol. The idea was to use push() and pop(). I guess I understand now my problem, using a foreach there evaluates the size of @file each time I think, and by the time it gets halfway thru it believes that it has gone thru the entire set? ?? how confusing. I will use while from now on
In reply to Using Push and Pop. by dark314
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |