Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Search and Replace Elements from 1 array to another.

by Riales (Hermit)
on Apr 03, 2012 at 17:46 UTC ( #963284=note: print w/replies, xml ) Need Help??


in reply to Re^2: Search and Replace Elements from 1 array to another.
in thread Search and Replace Elements from 1 array to another.

Shouldn't be much of a change. The only somewhat tricky part might be a fancier use of split in order to avoid having to concatenate the first few values together after splitting them previously. I think this should work:

# Instead of the existing split in the code I wrote... my ($pre, $possible) = split / ([^ ]+)$/, $stu;

That way, you can just concatenate $pre to the beginning of $matched_dp when you assign to $stu.

As a sidenote, am I the only one that was surprised to find that Perl does not have an rsplit function? This is possibly the first time I've found myself thinking 'Gee, if this were Python...' :P

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://963284]
help
Chatterbox?
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on search.cpan.org looking at a module,
[atcroft]: and it referred to several other modules, but the links went to metacpan.org. I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2017-05-27 03:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?