Hi,

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


You could just wrap it in an if statement:

eg
        if ($refH->{"Key"}) {
                print "This is just text " . $refH->{"Key"} . " this is still text\n"
        } else {
                print "Don't print the value as blank\n"
        }


Regards,

Craig A

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to