[SP-pm] Problemas numa comparação
Daniel de Oliveira Mantovani
daniel.oliveira.mantovani at gmail.com
Wed Jul 8 10:33:33 PDT 2009
2009/7/8 Eden Cardim <edencardim em gmail.com>
> 2009/7/8 Daniel de Oliveira Mantovani <daniel.oliveira.mantovani em gmail.com
> >:
> > Olha esse código, vai te ajudar.
> >
> > my $x = 1;
> > my $y = undef;
> > my $z = 0;
> >
> > if ( defined $x ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( defined $y ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( defined $z ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( $x ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( $y ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( $z ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( defined $x and defined $z ) { print "Verdadeiro\n"; } else { print
> > "Falso\n"; }
> >
> > if ( $x and $z ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( $x or $z ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
> >
> > if ( defined $y or $z ) { print "Verdadeiro\n"; } else { print "Falso\n";
> }
> >
> > if ( $y or $z ) { print "Verdadeiro\n"; } else { print "Falso\n"; }
>
> Nada nesse código tem relação alguma com o problema do cláudio, o que
> ele queria saber era como fazer uma operação bitwise entre dois
> valores.
Acabei de ver o que é bitwise.
perl -E 'say "10" if 10 & 5'
1010
0101
--------
0000
Falso.
perl -E 'say "10" if 5 & 5'
0101
0101
-------
0101
Verdadeiro.
Só não entendi porque usar isso em um script Perl.
[]'s
>
>
> --
> Eden Cardim Need help with your Catalyst or DBIx::Class project?
> Code Monkey http://www.shadowcat.co.uk/catalyst/
> Shadowcat Systems Ltd. Want a managed development or deployment platform?
> http://edenc.vox.com/ http://www.shadowcat.co.uk/servers/
> _______________________________________________
> SaoPaulo-pm mailing list
> SaoPaulo-pm em pm.org
> http://mail.pm.org/mailman/listinfo/saopaulo-pm
>
--
http://mantovanihouse.blogspot.com/
This is my poney:
-------(\_------------_/)-----------
-------)--(----------)--(-----------
------(----(---------)----)----------
-------)----(-------)----(-----------
-------(----(-------)----)-----------
--------\_-(\\.---.//)-_/------------
----------\)' -8--8- '(/--------------
-----------/------------\---------------
----------(--)--------(--)--------------
------------(_c__c_)----------------
----------------------------------------
perl -MLWP::Simple -le 'grep{ print $1 if /href="(http.+?)"/}split($/,get("
http://www.perl.org.br"))'
-------------- Pr?xima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/saopaulo-pm/attachments/20090708/4704d531/attachment-0001.html>
More information about the SaoPaulo-pm
mailing list