Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: String manipulation

by Athanasius (Chancellor)
on Dec 15, 2012 at 03:01 UTC ( #1008926=note: print w/replies, xml ) Need Help??

in reply to String manipulation

Here is one way:

#! perl use Modern::Perl; my $a = "December 14th 2012"; my $b = "December 21st 2012"; my $c = "December 22nd 2012"; for ($a, $b, $c) { my @fields = split; $fields[1] =~ s/st|nd|rd|th//; $_ = join(' ', @fields); say; }


12:58 >perl December 14 2012 December 21 2012 December 22 2012 12:58 >

Hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1008926]
[Lady_Aleena]: shmem, thanks. I'm am way out of practice.
[shmem]: perl -lE '@foo = (0..3);@bar = (4..7); push @foo,@bar; say for @foo'
[Lady_Aleena]: shmem, I feel like an idiot for forgetting something so basic.
shmem puts a big cauldron of "silly con charme" on the table in the refectorium
[reisinge]: 'push @foo, @bar' is the same as '@foo = (@foo ,@bar)' ?
[shmem]: yes, at least for the result in @foo

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2017-04-27 11:31 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (503 votes). Check out past polls.