Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Store the outcome of a foreach loop in an array

by BillKSmith (Monsignor)
on Jan 11, 2019 at 04:25 UTC ( [id://1228355]=note: print w/replies, xml ) Need Help??


in reply to Store the outcome of a foreach loop in an array

Note: This is the type of transform that map was designed for.
use strict; use warnings; my $lines = [ "c1r1,c2r1,c3r1,c4r1,c5r1\n", "c1r2,c2r2,c3r2,c4r2,c5r2\n", "c1r3,c2r3,c3r3,c4r3,c5r3\n", ]; my @store = map {(split /,/)[2]} @$lines; local $, = ",\n"; print @store;
Bill

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 15:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found