Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: How can one find out the pairwise difference and product between elements in a perl array without using a perl module?

by hdb (Monsignor)
on Sep 13, 2013 at 13:50 UTC ( [id://1053939]=note: print w/replies, xml ) Need Help??


in reply to How can one find out the pairwise difference and product between elements in a perl array without using a perl module?

And a complete solution:

use strict; use warnings; my @array=qw/a b c d/; my $diff = join"",map{s/(\d+)/$array[$1]/g;$_.$/}grep{eval$_<0}glob("{ +".join(",",0..$#array)."}-{".join(",",0..$#array)."}"); my $prod = $diff; $prod =~ tr/-/./; print "Differences:\n$diff\nProducts:\n$prod";
  • Comment on Re: How can one find out the pairwise difference and product between elements in a perl array without using a perl module?
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found