Gossamer Forum
Home : Products : Gossamer Links : Development, Plugins and Globals :

Do I quote these values or not?

Quote Reply
Do I quote these values or not?
I am a bit confused as when to quote things.

Code:
my $dist = $IN->param('dist'); # Need quotes?

my $opts = Links::Plugins->get_plugin_user_cfg('ZipCodeSearch');
my $osth = $zipcode_db->select({ 'ZipCode' => $link->{$opts->{'links_zipcode_col'}} })->fetchrow_hashref;
my $currlon = $osth->{'Zip'}; # Need quotes?

Thanks in advance,
Chris
RGB World, Inc. - Software & Web Development.
rgbworld.com
Quote Reply
Re: [rgbworld] Do I quote these values or not? In reply to
yes, don't have to, don't have to

first one is an argument to a function, nothing special, you're passing it a string, you need to quote it.
second and third ones are hash keys, so you can use them or not in those particular cases. If they're just words (a-z0-9_) then you don't need to quote them (there are more rules than that, but I won't bother going into them). When in doubt, just quote them.

Adrian