Hi fellow Monks

I have 2 machines both running perlbrew Perl 5.16.0 and both using the same version of Data::Printer. The small script below produces contradictory results on the 2 machines:

machine 1: $ perl --version This is perl 5, version 16, subversion 0 (v5.16.0) built for x86_64-li +nux $ perl -MData::Printer -le 'print $Data::Printer::VERSION' 0.36 $ cat /tmp/x.pl use 5.016; use strict; use warnings; use Data::Printer {alias => "pp", return_value => 'dump'}; my @x = (1,2,3); say pp(\@x); $ perl /tmp/x.pl Type of arg 1 to Data::Printer::p must be one of [@$%&] (not reference + constructor) at /tmp/x.pl line 8, near "@x)" Execution of /tmp/x.pl aborted due to compilation errors. Now edit script to take '\' out from the pp call and rerun: $ perl /tmp/x.pl [ [0] 1, [1] 2, [2] 3 ]
machine 1: $ perl --version This is perl 5, version 16, subversion 0 (v5.16.0) built for i686-linu +x $ perl -MData::Printer -le 'print $Data::Printer::VERSION' 0.36 $ cat /tmp/x.pl use 5.016; use strict; use warnings; use Data::Printer {alias => "pp", return_value => 'dump'}; my @x = (1,2,3); say pp(\@x); $ perl /tmp/x.pl [ 1, 2, 3 ] Now edit script to take '\' out from the pp call and rerun: $ perl /tmp/x.pl When calling p() without prototypes, please pass arguments as referenc +es at /tmp/x.pl line 8.

So on one one machine I'm told to pass a reference and on the other machine I'm told to not pass a reference. Any idea what is causing this? I'd like to run the same code on both machines but I cannot see why they differ.


In reply to Problems with Data::Printer and prototypes by mje

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.