[sf-perl] A bit of an eye opener with capture variables
Andy Lester
andy at petdance.com
Thu Aug 3 13:13:46 PDT 2006
On Aug 3, 2006, at 3:11 PM, David Alban wrote:
> I've always thought that anything that didn't get matched was made to
> be undef. I was very surprised to learn otherwise:
Right, I've made that assumption, too, and it makes things very sad.
You always want to check for the truth of the match operator:
if ( $str =~ /(something)/ ) {
... then I can use $1;
}
--
Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance
More information about the SanFrancisco-pm
mailing list