Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: perl one liner

by irah (Pilgrim)
on Apr 02, 2009 at 13:43 UTC ( [id://754964]=note: print w/replies, xml ) Need Help??


in reply to perl one liner

my ($day,$month,$year) = split("/",$date);

Replies are listed 'Best First'.
Re^2: perl one liner
by johngg (Canon) on Apr 02, 2009 at 15:42 UTC
    my ($day,$month,$year) = split("/",$date);

    I think that code is answering a different question, but you could have answered the OP's one by adding a join.

    my $var1 = q{10/02/2009}; my $var2 = join q{}, split m{/}, $var1;

    Another way would be to use tr, for details look in Quote Like Operators;

    my $var1 = q{10/02/2009}; ( my $var2 = $var1 ) =~ tr{/}{}d;

    I hope this is of interest.

    Cheers,

    JohnGG

    Update: Added my declarations to second code snippet.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found