doubtingben has asked for the wisdom of the Perl Monks concerning the following question:
but this doesn't :#!/usr/bin/perl use strict; my $string = "9/1/2001"; my ($month, $day, $year) = split('/', $string); my $new_date = join('-', $year, $month, $day); print "$new_date\n";
$new_date becomes: "-month-day". I tried:... my $string = $line[11]; my ($month, $day, $year) = split('/', $string); my $new_date = join('-', $year, $month, $day); ...
But I get the same result. After some experimentation, it seems the month is starting at the beginning of the string, and overwriting everything after it. During debugging, I see the split works fine, I just can't seem to put it back together correctly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: concating problem
by Thelonius (Priest) on Apr 21, 2003 at 17:26 UTC | |
by doubtingben (Novice) on Apr 21, 2003 at 18:31 UTC | |
|
Re: concating problem
by krujos (Curate) on Apr 21, 2003 at 17:16 UTC | |
|
Re: concating problem
by Mr. Muskrat (Canon) on Apr 21, 2003 at 18:18 UTC |