http://www.perlmonks.org?node_id=1006104


in reply to need help to print some lines

Rethink your notion that you can "print form (sic) a to e and then to return in line of and print f to j". You can't undo the printing of a newline in the manner you describe, any more than you can put the toothpaste back in the tube (or the genie back in the bottle, if you prefer).

Instead, consider determining the length of your array and dividing by two to derive the appropriate values in Lns 8 & 9 (which are hardcoded below and left as an exercise for the OP):

#!/usr/bin/perl use 5.014; # enable features, strict and warnings my @arr = qw(a b c d e f g h i j); my $i=0; while ( $i <=4 ) { my $j = $i+5; say "$arr[$i] \t $arr[$j]"; $i++; }

Hint: reading about the var $#, scalar(@arr) or searching for "array length" will be instructive.

Afterthought: obviously, I've understood meaning of the SOPW differently than some other Monks. Since OP provides no code, and only (IMO) an ambiguous spec, it seems plausible that the OP is trying to print a simple, 10 element array with a single letter is each element as a set of lines with the first half of the elements in column 1 and the second half in column 2.