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

Re: regexp wizardry needed

by Kenosis (Priest)
on Jan 25, 2013 at 17:11 UTC ( #1015374=note: print w/replies, xml ) Need Help??

in reply to regexp wizardry needed

Perhaps the following will be helpful:

use strict; use warnings; my $lines2 = " PERIOD 13 OCT 06 OCT"; my @date = map ucfirst lc, split ' ', $lines2; print "$date[2] $date[3] and $date[2] $date[1]";


Oct 06 and Oct 13

Update: Removed an unnecessary map. Thanks, johngg!

Replies are listed 'Best First'.
Re^2: regexp wizardry needed
by johngg (Abbot) on Jan 25, 2013 at 23:24 UTC
    my @date = map ucfirst, map lc, split ' ', $lines2;

    I'm not sure why you are going with two maps, one would be sufficient.

    $ perl -E ' > $line = q{PERIOD 13 OCT 06 OCT}; > say for map ucfirst lc, split q{ }, $line;' Period 13 Oct 06 Oct $

    I hope this is of interest.



      I'm not sure why you are going with two maps...

      I didn't think of it, so this is certainly of interest. Greatly appreciate you sharing this, JohnGG!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1015374]
[Discipulus]: we can remedy: ♪♫ Happy monkday to you, Hapymonkday virtualsue..♫..
hippo waves at the other 6
NodeReaper sees 10 souls
shmem sees a creepy one
choroba is at a security training
[choroba]: the presenter was able to fix an expired certificate in their demo application, but now he's getting java stacktrace instead of the pages

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-04-24 11:08 GMT
Find Nodes?
    Voting Booth?