>my ( $yyyy, $mm, $dd ) = split /(-|\/)/, $yyyymmdd;
my ( $yyyy, $mm, $dd ) = split /-|\//, $yyyymmdd;
with this it works.

-----Original Message-----
From: Daniel Kasak [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 31, 2006 10:22 AM
To: beginners@perl.org
Subject: 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: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to