in reply to writing each array element to a unique file

First, an array is declared like so:
@myArr = ( 1,2,3,4,5,6,7,8,9,10,11 );
You can write each of these to a new files like this:
@myArr = ( 1,2,3,4,5,6,7,8,9,10,11 ); for my $item (@myArr) { open(ITEM ">$item") or die "could not open $item: $!\n"; print ITEM $item; close ITEM; }

Replies are listed 'Best First'.
Re^2: writing each array element to a unique file
by webfiend (Vicar) on Dec 15, 2006 at 00:14 UTC

    Except that an array is declared like so:

    my @myArr = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);

    :)

    You were thinking of an array ref, maybe?

    my $myArr = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ];
      duh, yeah. fixed.