Shawn H Corey wrote:
> John W. Krahn wrote:
>> Shawn H Corey wrote:
>>> Steve Bertrand wrote:
>>>> You can replace them all with this:
>>>>
>>>> my $station = $channels{ $opt_s };
>>> my $station = $channels{ $opt_s } || help();
>> my $station = $channels{ $opt_s } or help();
> 
> 
> my $station = $channels{ $opt_s } || '' or help();
> 
>> Or:
>>
>> ( my $station = $channels{ $opt_s } ) || help();
> 
> ( my $station = $channels{ $opt_s } || '' ) || help();
> 
> 
> Removes the warning about undefined value.  Of course, if help() returns
> with `return '';` then this version can be used:
> 
> my $station = $channels{ $opt_s } || help();

...what about his `.*` condition ie:

elsif($opt_s =~ /.*/) {
         $station = $opt_s;
}

(it was included in my message at 0826 hrs today)...can you jam that in
there too? Since it didn't have an entry in the hash, I'd assume that it
would have to be dealt with separately.

Or can you use a regex as a key in the hash itself?

Steve

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to