use strict; use warnings; #my $file = "data.txt"; my $file = \do{my $simulated_file = "line1\nline2\nline3\nline4\n";}; # Line above simulates the file. open (my $fh, '<', $file) or die "can't open file $!"; my @stack = <$fh>; chomp @stack; { local $, = "\n"; print reverse( @stack ), "\n"; } @stack = (); # Only needed if you wish to destroy the @stack OUTPUT: line4 line3 line2 line1
In reply to Re: Printing Stacks
by BillKSmith
in thread Printing Stacks
by drose2211
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |