[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

: I am trying to figure out how to print 8 scalers/elements
: then \n,  then 5 more lines of 8 or less for a max total
: of 40  Here is my code:
: 
: print FILEOUT "eject 0,0,0 ";
: my $count = `wc -l <$ejectapes`;
[snip]


    How about:

use strict;
use warnings;

use Tie::File;
use Array::Dissect qw( reform );

tie my @content, 'Tie::File', 'eject 0,0,0 '
    or die qw(Cannot open "eject 0,0,0 ": $!);

my $last_index = @content > 40 ? 39 : $#content;

print join( ' ', @$_ ), "\n"
    foreach reform( 8, @content[ 0 .. $last_index ] );


HTH,

Charles K. Clarkson
-- 
Mobile Homes Specialist
254 968-8328


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to