Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: appending arrays

by bivouac (Beadle)
on Nov 19, 2003 at 22:06 UTC ( [id://308421]=note: print w/replies, xml ) Need Help??


in reply to appending arrays

edited again: thanks for the correction. very primative and probably watseful, but it meets the reqs of the spec.

#!/usr/bin/perl -w use strict; my @one = qw(lots of nice words); my @two = qw(red clothes are fun); my @two_r = reverse @two; my @three; if (scalar @one == scalar @two_r) { for (my $i=0; $i < scalar @one; $i++) { push @three, $one[$i].$two_r[$i]; } } print $three[0], "\n"; print $three[1], "\n"; print $three[2], "\n"; print $three[3], "\n";

no points for second place in this dojo.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-19 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found