Scarborough has asked for the wisdom of the Perl Monks concerning the following question:
My first thought was that this would do nothing. I was wrong it didn't do what was expected but it did do something. When put into this contextsubstr($DATE, 2, 5) = $YEAR . $MONTH;
I'm not asking how to fix it I just wont to know how its doing whats its doing now?$YEAR = "2005"; $MONTH = "06"; $DATE = "20050608"; substr($DATE, 2, 5) = $YEAR . $MONTH; print $DATE; #output 202005068
UPDATE
It wasn't so much what it was trying to do as how it was doing it. The orginal SCL code from the mainframe did the same and was wrong as well. Thanks to all for explaining what is happenning.
The joke is the SCL code was passing the resulting $DATE to a utility to get the days since 1900. It was failing, however the code was last run in 2002 and the ops. here think it failed then as well. Historic conversions don't you just love um.....
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is substring working on here.
by BrowserUk (Patriarch) on Jun 09, 2005 at 15:15 UTC | |
|
Re: What is substring working on here.
by gellyfish (Monsignor) on Jun 09, 2005 at 15:11 UTC | |
by ikegami (Patriarch) on Jun 09, 2005 at 15:36 UTC | |
by Scarborough (Hermit) on Jun 09, 2005 at 15:17 UTC | |
|
Re: What is substring working on here.
by robartes (Priest) on Jun 09, 2005 at 15:16 UTC |