Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: need help to print some lines

by ww (Bishop)
on Nov 28, 2012 at 21:20 UTC ( #1006104=note: print w/ replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006104]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2016-07-26 01:07 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (231 votes). Check out past polls.