Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Concatenate array element and scalar

by Limbic~Region (Chancellor)
on Feb 27, 2004 at 15:36 UTC ( [id://332368]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Concatenate array element and scalar

user111,
Assuming your array is NOT what you are looping over, this is quite simple.
my @array = qw(a b c d e); my @new_array; for my $variable ( 1 .. 5) { push @new_array, "$_ $variable" for @array; } print "$_\n" for sort @new_array;
If that's not what you want you will need to explain what you want more clearly.

Cheers - L~R

Update: The original node was updated after I posted to include sample code, you want to change:

push(@result,$new[$k]); push(@result,$test); # to push @result , "$new[$k] $test";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://332368]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.