Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: The best way to search an array ? Keywords: detab Message-ID: <111028@convex.convex.com> Date: 13 Dec 90 20:47:46 GMT References: <443@stephsf.stephsf.com> <1990Dec3.035541.24184@agora.uucp> <452@stephsf.stephsf.com> Sender: news@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 29 From the keyboard of wengland@stephsf.stephsf.com (Bill England): :sub main'State_Check { : local($state) = @_; : $state =~ y/a-z/A-Z/; : : return $state if defined($st_abr{$state}); : return $st_name{$state} if defined($st_name{$state}); : return (); :} : Hmm... shouldn't that last one be: return ''; # or return undef or since explicit returns cost more than implicit ones: ''; # or undef The null _scalar_ value in perl is '' (defined) or undef (undefined), whereas () is an empty list. It probably will work out ok as is, but it's one of those scalar/vector confusion things that always make me at least a little nervous, like saying @x[1] when you mean $x[1]. --tom -- Tom Christiansen tchrist@convex.com convex!tchrist "With a kernel dive, all things are possible, but it sure makes it hard to look at yourself in the mirror the next morning." -me