in reply to Handling uninitialized values
I am assuming that you have some kind of loop going on where $sub_dir may or may-not be assigned. In that case I would try something like:
This will fail if $foo == 0 so if that is a possibility then you could use..my $path = join('', $dir, ($foo || ''), $file);
my $path = join('', $dir, (defined $foo ? $foo : ''), $file);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Handling uninitialized values
by blue_cowdawg (Monsignor) on May 23, 2001 at 01:01 UTC | |
|
Re: Re: Handling uninitialized values
by THRAK (Monk) on May 23, 2001 at 16:12 UTC |