Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Rewrite Program Using Arrays

by mbethke (Hermit)
on Mar 25, 2012 at 23:43 UTC ( #961554=note: print w/replies, xml ) Need Help??


in reply to Re^2: Rewrite Program Using Arrays
in thread Rewrite Program Using Arrays

Hm, I suppose you meant something like this:
my @globalarray; foreach my $filename (@ARGV) { open my $fh, '<', $filename or die "$filename: $!"; my @temparray = <$fh>; push @globalarray, @temparray; close $fh; }
Guess you could learn the use of "push", that's about the only thing. It's used to append a scalar or a whole list to the end of an array. "pop" does the opposite and takes one scalar off. shift and unshift work the same, just on the start of the array.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://961554]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2016-09-01 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (439 votes). Check out past polls.