Someone posted this regex question which I can't understand for.
perl -e '$_=abc.e.i;
s/(\.\w+)?$/.out/;
print;'
the result is: abcei.out
Why is this?Please help explain it.Thanks!
_
FREE Email @ Fadmail.com - http://www.fa
On 3/7/07, Jennifer Foo <[EMAIL PROTECTED]> wrote:
Someone posted this regex question which I can't understand for.
perl -e '$_=abc.e.i;
s/(\.\w+)?$/.out/;
print;'
the result is: abcei.out
Why is this?Please help explain it.Thanks!
I think you will be less confused if you change the
Jennifer Foo wrote:
> Someone posted this regex question which I can't understand for.
>
> perl -e '$_=abc.e.i;
> s/(\.\w+)?$/.out/;
> print;'
>
> the result is: abcei.out
>
> Why is this?Please help explain it.Thanks!
$_=abc.e.i;
This is short for:
$_ = 'abc' . 'e' . 'i';
$_=abc.e.i;
This is short for:
$_ = 'abc' . 'e' . 'i';
Which is the same as saying:
$_ = 'abcei';
Thanks.I never knew that it can write a string like this way.
_
FREE Email @ Fadmail.com - http://www.fadmail.com
--
On 3/7/07, Jennifer Foo <[EMAIL PROTECTED]> wrote:
$_=abc.e.i;
This is short for:
$_ = 'abc' . 'e' . 'i';
Which is the same as saying:
$_ = 'abcei';
Thanks.I never knew that it can write a string like this way.
You probably shouldn't though. It is a carry over from the earli
I have to say - I am totally enamored with regex. Color me
'goober'. I just think that is a beautiful, concise, elegant way to
make a substitution. All of that capability in one short string of
characters... No if, then, else construct. Just - capture what is
there; if it matches a .\w
> $_=abc.e.i;
>
> This is short for:
>
> $_ = 'abc' . 'e' . 'i';
>
> Which is the same as saying:
>
> $_ = 'abcei';
>
Why is $_=abc.e.i short for
$_ = 'abc' . 'e' . 'i';
Is it b/c each group of characters is a 'token'
including the periods?
abc => token
. =>
On 3/8/07, oryann9 <[EMAIL PROTECTED]> wrote:
snip
Why is $_=abc.e.i short for
$_ = 'abc' . 'e' . 'i';
snip
from "Programming Perl 3rd Edition":
bareword
A word sufficient ambigious to be deemed
illegal under use strict 'subs'. In the
absence of that stricture, a barew
Yes I understand now. For some reason I missed the
missing quotes in the original post and the word token
came to mind.
$ perl -MO=Deparse foo.plx
BEGIN { $^W = 1; }
use diagnostics;
sub abc {
use warnings;
use strict 'refs';
'abc.';
}
sub e {
use warnings;
use strict 'ref