develooper Front page | perl.perl5.porters | Postings from January 2011

Re: Using smart matching to find whether an array contains a string

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
January 27, 2011 01:57
Subject:
Re: Using smart matching to find whether an array contains a string
Message ID:
20110126195911.18894.qmail@lists-nntp.develooper.com
On 2011-01-26 15:22, Ed Avis wrote:

>      % perl -E '@a = ("1"); say "1 x" ~~ @a'
>
>      % perl -E '@a = (1); say "1 x" ~~ @a'
>      1
>
> So you have to be aware of the difference between 1 and '1'.
> This is the only place in everyday Perl programming where the difference is
> noticeable.

Who doesn't use Data::Dumper daily?

perl -MData::Dumper -wle 'print Dumper [ 0, "0", 0.0, 0_0, 0_0.0, ]'

$VAR1 = [
           0,
           '0',
           '0',
           0,
           '00'
         ];

-- 
Ruud

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About