in reply to Re: chomp a List
in thread chomp a List

print join "," => @to_print;
I never saw this ! Does this means that one can use => instead of a coma everywhere ?
Is there a precedence difference ?
I'm used to do :
print join(",", @to_print)
which is obviously less idiomatic .

Replies are listed 'Best First'.
Re^3: chomp a List
by tirwhan (Abbot) on Feb 08, 2005 at 12:12 UTC

    => is almost the same as ,

    The difference is that => forces the value to the left of it to be interpreted as a quoted string

    This is why
    #!/usr/bin/perl -w my %a=( foo => "bar", fi , "fo");

    Will get you a warning for the unquoted fi, but not the unquoted foo. However, normal operator precedence still applies, so

    print join , => @to_print;
    won't work, whereas
    print join or => @to_print;
    will.
      cool :) or is seen as a string ... thx !