Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How to check if the date is in format 'YYYYMMDD' and replace it with 'YYMMDD'. 20070820 is in YYYYMMDD, is to replaced with 070820. 070223 is already in the format YYMMDD, so I should not replace it. Please tell me how to replace it.#!/usr/bin/perl while(<DATA>){ s/^\d\d//g; print $_; } __DATA__ 20070820 070223 20080929
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: date replace
by ikegami (Patriarch) on Dec 11, 2009 at 06:09 UTC | |
| |
|
Re: date replace
by bichonfrise74 (Vicar) on Dec 11, 2009 at 06:08 UTC | |
|
Re: date replace
by AnomalousMonk (Archbishop) on Dec 11, 2009 at 11:35 UTC |