On 04/28/2012 09:16 AM, sono-io@fannullone.us wrote: > I'm having a problem with the following code: > > #!/usr/bin/perl > use strict; > use warnings; > > my $xtra = 'mail.example.com'; > > my $host = 'localhost' unless (defined ($xtra)); > > print $host; > > I get the message "Use of uninitialized value $host in print". Does anyone know why this doesn't work? > > Thanks, > Marc Greetings. It doesn't work, because $host is uninitialized. What did you expect it to be?Thread Previous | Thread Next