Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: altering and printing an array

by gopalr (Priest)
on Dec 08, 2005 at 15:35 UTC ( [id://515270]=note: print w/replies, xml ) Need Help??


in reply to altering and printing an array

Hi Gaurav,

Use "pairwise" method of List::MoreUtils module.

use List::MoreUtils qw(pairwise); @versionArray = ("1.000.10.01","1.000.10.01"); @dateArray= ("110905","111505"); @result=pairwise{replace($a, $b)} @dateArray, @versionArray; print "\ndate\t\tversion\n"; $"="\n"; print "\n@result"; sub replace { my ($a,$b)=@_; $a=~s#([0-9]{2})([0-9]{2})([0-9]{2})#$1/$2/$3#g; return "$a\t$b"; }

Output:

date version 11/09/05 1.000.10.01 11/15/05 1.000.10.01

Thanks,
Gopal.R

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://515270]
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 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found