Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 examining the Monastery: (6)
As of 2014-09-18 02:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (105 votes), past polls