split and grouping in regexp



I'm trying to split a date where the values can be separated by a dash '-' or a slash '/', eg:
2006-10-31 or 2006/10/31

I'm using:
my ( $yyyy, $mm, $dd ) = split /(-|\/)/, $yyyymmdd;
but it doesn't work.

If I just do:
my ( $yyyy, $mm, $dd ) = split /-/, $yyyymmdd;
it works for dates separated by dashes, and if I do:
my ( $yyyy, $mm, $dd ) = split /\//, $yyyymmdd;
it works for dates separted by slashes.

Why can't I do both at the same time?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@xxxxxxxxxxxxxxxxxxxx
website: http://www.nusconsulting.com.au
.



Relevant Pages

  • Re: IsWeekend() or IsWeekday()
    ... one could verify the last one pretty ... >Some people use a dash instead of a slash, ... Prev by Date: ...
    (comp.lang.basic.visual.misc)
  • Re: IsWeekend() or IsWeekday()
    ... > Some people use a dash instead of a slash, ... Making similar assumptions as to viability of text being a date if it ... Prev by Date: ...
    (comp.lang.basic.visual.misc)
  • Re: PEP 401
    ... Heck, just look at its number and mentally insert one slash or dash. ... I have a blog: ...
    (comp.lang.python)
  • Can I enter a date without using the / or hyphen?
    ... I am trying to format a cell so I can type in the date without the slash or ... dash. ...
    (microsoft.public.excel.misc)
  • Re: IsWeekend() or IsWeekday()
    ... Some people use a dash instead of a slash, ... Michael B. Johnson ...
    (comp.lang.basic.visual.misc)