Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Splitting Multiple files into arrays.

by rjt (Curate)
on Jul 20, 2013 at 21:24 UTC ( [id://1045472]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use 5.012;
    use warnings;
    use autodie;
    ...
    
    $" = '> <';
    say "\$array[$_] = <@{$array[$_]}>" for 1..$#array;
    
  2. or download this
    $array[1] = <foo> <bar> <baz>
    $array[2] = <one> <two> <three> <four> <five> <six>
    $array[3] = <apple> <pear> <mango>
    
  3. or download this
    my %hash;
    for my $file (glob 'file*.txt') {
        local $/; # Slurp
    ...
    }
    $" = '> <';
    say "\$hash[$_] = <@{$hash{$_}}>" for keys %hash;
    
  4. or download this
    file1.txt:
      foo bar baz
    ...
      four five six
    file3.txt:
      apple pear mango
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-24 02:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found