On Wed, 17 Dec 2003, Alexander Samad wrote:
> Hi
>
> I have a hash array which is being passed by ref, now I would like to
> access an element inside an "" for a print statement
>
> like
>
> print "This is just text $refH->{"Key"} this is still text\n"
>
> but I keep getting errors so I have to re write as
>
> print "This is just text " . $refH->{"Key"} . " this is still text\n"
>
> Which causes problems if $refH->{"Key"} equates to blank
print "this is just text ",$refH->{"Key"}," this is still text\n";
or
print "this is just text $refH->{Key} this is still text\n";
IE you can get away without quoting the subscript if the subscript could
be a valid variable name (basically alphanumeric plus underscore). The top
line is the safe option but the bottom is just nicer reading.
--
---<GRiP>---
Electronic Hobbyist, Former Arcadia BBS nut, Occasional nudist,
Linux Guru, SLUG/AUUG/Linux Australia member, Sydney Flashmobber,
BMX rider, Walker, Raver & rave music lover, Big kid that refuses
to grow up. I'd make a good family pet, take me home today!
Do people actually read these things?
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html