in reply to Re: Array function to concatenate
in thread Array function to concatenate

I'm sure there is a pretty solution with map but ...

I'm not sure about pretty but it is fairly straightforward.

In your code, as well as the slightly dubious use of sprintf, I wonder why you trample over @Portal_Name and use two for loops when you could have done a print (or even a printf if you insist) in the first loop.

use strict; use warnings; my @Code = qw{ 404 408 }; my @Portal_Name = qw{ http://software.com http://yahoo.com }; my @Text = ( q{Not found}, q{Request Timeout} ); print map { qq{$Code[$_] $Portal_Name[$_] $Text[$_]\n} } 0 .. $#Portal_Name;

The output.

404 http://software.com Not found 408 http://yahoo.com Request Timeout

I hope this is of interest.

Cheers,

JohnGG

Replies are listed 'Best First'.
Re^3: Array function to concatenate
by gowrisub (Initiate) on Oct 11, 2008 at 02:27 UTC
    Thanks all for your help..Its realy interesting to know different ways of getting info. Regards, Gowri