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 ( #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


Comment on Re: altering and printing an array
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2015-07-07 08:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (87 votes), past polls