Xref: utzoo news.software.b:3633 comp.sources.d:4403 Path: utzoo!utstat!jarvis.csri.toronto.edu!mailrus!cwjcc!hal!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery) Newsgroups: news.software.b,comp.sources.d Subject: Re: C News "upact" in Perl 3.0 Message-ID: <1989Nov22.233553.7585@NCoast.ORG> Date: 22 Nov 89 23:35:53 GMT References: Reply-To: allbery@ncoast.ORG (Brandon S. Allbery) Followup-To: news.software.b Organization: North Coast Public Access UN*X, Cleveland, OH Lines: 30 As quoted from by tale@pawl.rpi.edu (David C Lawrence): +--------------- | sub dirlow { | local ($dir) = @_; | local ($low, $f); | | opendir(dir,$dir) || return ""; | $low = ""; >----------------^^ | while ($f = readdir(dir)) { | printf "%s\n", $f; | next unless $f =~ /^[0-9]+$/; | $low = $f if ($low eq "") || ($f < $low); >------------------------------------^^^^^---------^^^^^^ | } | closedir(dir); | return $low; | } +--------------- "eq" applies to strings; "<" applies to numbers. Best not to mix them; as the Perl manual suggests, you can get unpleasant surprises. ++Brandon -- Brandon S. Allbery allbery@NCoast.ORG, BALLBERY (MCI Mail), ALLBERY (Delphi) uunet!hal.cwru.edu!ncoast!allbery ncoast!allbery@hal.cwru.edu bsa@telotech.uucp *(comp.sources.misc mail to comp-sources-misc[-request]@backbone.site, please)* *Third party vote-collection service: send mail to allbery@uunet.uu.net (ONLY)* expnet.all: Experiments in *net management and organization. Mail me for info.