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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515270]
help
Chatterbox?
[karlgoethebier]: Listen to Glenn: https://www. youtube.com/watch? v=SiiVK3rMxxg
[karlgoethebier]: marioroy: If you provide an email address i'll send you the full script of TNOG...
[karlgoethebier]: marioroy: Checkout also "Linear Expressions" by the same author...
[marioroy]: thanks karlgoethebier.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (15)
As of 2017-03-24 10:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (298 votes). Check out past polls.