Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Splitting Multiple files into arrays.

by rjt (Deacon)
on Jul 20, 2013 at 21:24 UTC ( #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
Node Status?
node history
Node Type: note [id://1045472]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2015-07-03 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls