in reply to strange regexp problem

What the hell does this line $cwd =~ qw "(/.*)/" ; do and what do you expect it to do?

The =~ operator is for binding Regular Expressions to a variable, ex: $foo=~m/stuff/;

qw Is an operator that splits a group of words on whitespace. It returns a list. Feeding it's output to the =~ operator probably doesn't do what you want (I'm not really sure what it does do for that matter).

Replies are listed 'Best First'.
Re: Re: strange regexp problem
by iwanthome (Beadle) on Apr 06, 2004 at 08:40 UTC

    Sorry for my stupid error.But it can't work too after I change the "qw" to "m".Perl report same error.

    Can you give more advice ?

    thanks very much!