[Melbourne-pm] When your variables can't keep their types..
Mathew Robertson
mathew.blair.robertson at gmail.com
Fri Jun 3 01:36:25 PDT 2016
$port is a number, $foo is a string.
$port hasn't be coerced into a string
On 3 June 2016 at 14:49, Toby Corkindale <
toby.corkindale at strategicdata.com.au> wrote:
> Guess the output...
>
>
> #!/usr/bin/env perl
> use 5.12.0;
> use warnings;
> use JSON::XS qw(encode_json);
>
> my $port = 1234;
>
> my $j1 = encode_json({ port => $port });
> my $foo = "$port";
> my $j2 = encode_json({ port => $port });
>
> say $j1;
> say $j2;
>
> if ($j1 ne $j2) {
> die "WTF Perl?!";
> }
>
> _______________________________________________
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
> http://mail.pm.org/mailman/listinfo/melbourne-pm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/melbourne-pm/attachments/20160603/9f55964b/attachment.html>
More information about the Melbourne-pm
mailing list