Here are some examples using print, to show the quoting ability before the =>
I personally would highly recommend against using => where a comma "," is meant (i.e. your bless statement). And I would also highly recommend its use when defining elements of a hash or calling a function that expects a hash (occurs often in GUI code, -width => 5.0)#!/usr/bin/perl use strict; use warnings; print "abc" => "xyz\n"; #prints abcxyz print abc => "xyz\n"; #prints abcxyz print "abc", "xyz\n"; #prints abcxyz (most natural formulation) #print abc, "xyz\n"; #prints No comma allowed after filehandle at C +:\Projects_Perl\testing\junk1.pl line 7.
update: When I see =>, I think hash, even if I do the double quoting on the left side explictly, e.g. "key with embedded space" => 32
In reply to Re: Difference between comma and => when calling subroutine
by Marshall
in thread Difference between comma and => when calling subroutine
by zizu1985
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |