PetreAdi has asked for the wisdom of the Perl Monks concerning the following question:
How do I extract the first 2 elements of an array and add to end
__DATA__
1234
5678
1000
1233
$file="abc.txt"; open (DAT, "<$file")|| die("Cannot Open File"); @array = <DAT>; close (DAT);
The output should be:
print @newarray
123412
567856
100010
123312
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array manipulation
by kschwab (Vicar) on Nov 04, 2013 at 18:21 UTC | |
|
Re: Array manipulation
by 2teez (Vicar) on Nov 04, 2013 at 18:15 UTC | |
|
Re: Array manipulation
by Anonymous Monk on Nov 05, 2013 at 03:41 UTC | |
|
Re: Array manipulation
by BillKSmith (Monsignor) on Nov 05, 2013 at 04:33 UTC | |
|
Re: Array manipulation
by johngg (Canon) on Nov 05, 2013 at 10:35 UTC |