in reply to Re: trivial wrapping
in thread trivial wrapping

Hi BrowserUk, thanks for your help. Unfortunatley I am having problems getting this to work.. i dont completely understand your code and cant see where to plug in my two strings ($genome1 and $genome2). Can i do ;
my @strings = map {$genome1, $genome2};
or something like? thanks again ;-)

Replies are listed 'Best First'.
Re: Re: Re: trivial wrapping
by BrowserUk (Patriarch) on Nov 18, 2002 at 13:57 UTC

    You dont need the map, a simple array assignment will do.

    my @strings = ($genome1, $genome2);

    Update. That said, if you don't have your strings in an array, and its difficult to put them into one to start with, a small modification to the routine will prevent needless duplication.

    #! perl -sw use strict; # ... your existing code.... my @strings = \($genome1, $genome2); my ($total, $p) = (0, 0); do { $total = 0; #NOTE: Extra $'s v ........................................v print substr( $$strings[$_]}, $p, 60 ) . "\n" for 0 .. $#$strings; print "\n"; $p+=60; $total += length($_) - $p for @$strings; # And here! } while( $total > 0 ); __END__

    Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
    Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
    Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
    Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.