1) save it to peter.pl
2)
$ perl -MO=Deparse,-p peter.pl
Useless use of numeric eq (==) in void context at peter.pl line 7.
Useless use of numeric eq (==) in void context at peter.pl line 8.
use warnings;
use strict 'refs';
(my $q = 'xxx');
(my(@w) = 1);
((my $v1 = ($q =~ /x/)) and (@w == 0));
((my $v2 = ($q =~ /x/)) and (@w == 0));
(my $v3 = (($q =~ /x/) && (@w == 0)));
((my $v4 = (@w == 0)) and ($q =~ /x/));
print("v1 = $v1\n");
print("v2 = $v2\n");
print("v3 = $v3\n");
print("v4 = $v4\n");
peter.pl syntax OK
for a quick answer
Gabor
On Mon, Jul 20, 2009 at 10:01 AM, Peter Gordon<[email protected]> wrote:
> Would someone care to show how the lines
> starting with my $v1, my $v2, my $v3 and my $v4 are
> being parsed.
>
> The lines starting my $v1 and my $v2 gives warnings.
> And the results are to say the least, curious.
>
>
> use strict ;
> use warnings ;
>
> my $q = "xxx" ;
> my @w = (1) ;
>
> my $v1 = $q =~ m!x! and @w == 0 ;
> my $v2 = ($q =~ m!x!) and (@w == 0) ;
> my $v3 = $q =~ m!x! && @w == 0 ;
> my $v4 = @w == 0 and $q =~ m!x! ;
>
> print "v1 = $v1\n" ;
> print "v2 = $v2\n" ;
> print "v3 = $v3\n" ;
> print "v4 = $v4\n" ;
>
> Peter
>
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>
--
Gabor Szabo http://szabgab.com/blog.html
Perl Training in Israel http://www.pti.co.il/
Test Automation Tips http://szabgab.com/test_automation_tips.html
Perl 6 Tricks and Treats http://szabgab.com/perl6_tricks_and_treats.html
"He who can, does. He who cannot, teaches." - George Bernard Shaw
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl