Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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.

Comment on Re^3: Rewrite Program Using Arrays
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2015-11-26 14:10 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (701 votes), past polls