Re: Regex confusion...
- From: "comp.llang.perl.moderated" <ced@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 27 Sep 2007 22:04:40 -0700
On Sep 27, 6:43 pm, s...@xxxxxxxxxxxxxx wrote:
On Fri, 28 Sep 2007 00:10:42 +0100, Ben Morrow <b...@xxxxxxxxxxxx> wrote:^^^^^^^^^^^^^^^^^^^^^^^^^^
...
This can be simplified to
if (
my ($t, $zip, $type) =
$img =~ /^(\d)-(\d+)-(\w+)$/
) {
which avoids the need to use the $N variables altogether.
Ben
It might be quicker to check for sucess first then do the asignment
$_ = "......";
if ( /^(\d)-(\d+)-(\w+)$/ )
{
#use $1,2,3 or asign
($t, $zip, $type) = ($1, $2,
Are you sure... wouldn't your solution require an extra copy from
$N.
--
Charles DeRykus
.
- References:
- Regex confusion...
- From: guthrie
- Re: Regex confusion...
- From: Ben Morrow
- Re: Regex confusion...
- From: sln
- Regex confusion...
- Prev by Date: Re: why are references so slow ?
- Next by Date: Re: Small doubt in perl
- Previous by thread: Re: Regex confusion...
- Next by thread: Re: Regex confusion...
- Index(es):