On Dec 20, 2007 5:27 AM, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
snip
> $ts = ($test =~ m{(.+)\@/});
snip
> but again the same output. I am not getting output as "test"
snip

That is because you are still putting the regex in scalar context
instead of list context.  A regex in scalar context returns a 1 if it
matches and a 0 if it doesn't.  A regex in list context returns the
captures.  Just add a set of parenthesis around the target variable to
force list context.  While you are at it get rid of the useless
parenthesis you are using around $test =~ m{(.+)\@/}.

($ts) = $test =~ m{(.+)\@/};

Given what your code looks like I am also guessing you have not used
the warnings and strict pragmas, I cannot stress how important they
are.  Failure to use them will give you no end of headache (as you ca
already see from the @$ issue).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to