in reply to Transpose the contents of the file
The x as used here is the string multiplier, e.g.
$ perl -E 'say q{abc} x 3;' abcabcabc $
It can also be used as a list multiplier, e.g.
$ perl -E ' > @arr = ( 0 ) x 5; > $arr[ 3 ] = 7; > say qq{Element $_: $arr[ $_ ]} for 0 .. $#arr;' Element 0: 0 Element 1: 0 Element 2: 0 Element 3: 7 Element 4: 0 $
I hope this is helpful.
Cheers,
JohnGG
Update: Expanded the second code example to make it clearer that an array has been initialised.
|
|---|