>>>>> "SB" == Steve Bertrand <st...@ibctech.ca> writes:
SB> Am I correct in thinking that this: SB> $url = $file =~ m{ (.*) /A/\d+.html }x; SB> ...assigns '1' to $url because =~ binds tighter and assigns a 'true' SB> value to $url, whereas: SB> ( $url ) = $file =~ m{ (.*) /A/\d+.html }x; SB> ...$url here is evaluated first, and assigned the actual string SB> afterwards? iow, is it simply an arithmetic thing, that can also be seen SB> as this:? nope. it is scalar vs list context, not precedence. the () makes the assignment to $url happen in list context. the m// op in list context will return the list of grabs (with some variations based on the /g modifier). in scalar context m// only returns a boolean if the match succeeded or not. SB> ( $url ) = ( $file =~ m! (.*) /A/\d+.html !x ); SB> D'oh! I just answered my own question. Learn something new everyday, SB> even though it's a principle that I've known for years, but just didn't SB> apply it... that didn't change anything. =~ binds tighter than = anyway. it is still context that does it. SB> ( my $this ) = ( ( $url ) = ( $file =~ m! (.*) /A/\d+.html !x ) ); SB> print "$url :: $this\n"; that shouldn't make any difference to assigning $url in list context. uri -- Uri Guttman ------ u...@stemsystems.com -------- http://www.sysarch.com -- ----- Perl Code Review , Architecture, Development, Training, Support ------ --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com --------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/