Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
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 about the Monastery: (13)
As of 2014-09-16 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (24 votes), past polls