Re: split and grouping in regexp

2006-11-01 Thread Randal L. Schwartz
> "Daniel" == Daniel Kasak <[EMAIL PROTECTED]> writes: Daniel> I'm trying to split a date where the values can be separated by a dash '-' or Daniel> a slash '/', eg: Daniel> 2006-10-31 or 2006/10/31 If it's easier to talk about what to keep instead of what to throw away, don't use split -- u

Re: split and grouping in regexp

2006-10-30 Thread Dr.Ruud
Daniel Kasak schreef: > 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 ( $, $mm, $dd ) = split /(-|\/)/, $mmdd; > but it doesn't work. It does work, but not as you expected. Read `perldoc -f s

Re: split and grouping in regexp

2006-10-30 Thread Arnaldo Guzman
On Tue, 2006-10-31 at 12:22 +1100, Daniel Kasak wrote: > 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 ( $, $mm, $dd ) = split /(-|\/)/, $mmdd; > but it doesn't work. > > If I just do: > my

Re: split and grouping in regexp

2006-10-30 Thread John W. Krahn
Daniel Kasak wrote: > 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 ( $, $mm, $dd ) = split /(-|\/)/, $mmdd; > but it doesn't work. Yes it does work, it's just that the capturing parentheses

RE: split and grouping in regexp

2006-10-30 Thread bou, hou \(GE Money, consultant\)
>my ( $, $mm, $dd ) = split /(-|\/)/, $mmdd; my ( $, $mm, $dd ) = split /-|\//, $mmdd; 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

Re: split and grouping in regexp

2006-10-30 Thread Jeff Pang
> >I'm using: >my ( $, $mm, $dd ) = split /(-|\/)/, $mmdd; >but it doesn't work. > Hello, try split /\W/,$string pls. $ perl -le '$str="2006/10/31";my ( $, $mm, $dd ) = split /\W/, $str;print join " ",$, $mm, $dd' 2006 10 31 $ perl -le '$str="2006-10-31";my ( $, $mm, $dd