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. |