> "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
A Dilluns 30 Octubre 2006 02:34, xavier mas va escriure:
> A Dimarts 31 Octubre 2006 02:22, Daniel Kasak va escriure:
> > my ( $, $mm, $dd ) = split /(-|\/)/, $mmdd;
>
> split function can't accept an expression on its syntax, only a character
> as separator field.
> --
> Xavier Mas
you're
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
On Mon, 2006-10-30 at 02:34 +0100, xavier mas wrote:
> A Dimarts 31 Octubre 2006 02:22, Daniel Kasak va escriure:
> > my ( $, $mm, $dd ) = split /(-|\/)/, $mmdd;
>
> split function can't accept an expression on its syntax, only a character as
> separator field.
> --
> Xavier Mas
To Xavi
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
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
>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 reg
>
>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
A Dimarts 31 Octubre 2006 02:22, Daniel Kasak va escriure:
> my ( $, $mm, $dd ) = split /(-|\/)/, $mmdd;
split function can't accept an expression on its syntax, only a character as
separator field.
--
Xavier Mas
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-m
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 ( $, $mm, $dd ) = split /-/, $mmdd;
it works for dates separated b
10 matches
Mail list logo