<[EMAIL PROTECTED]> wrote: > > At 20:45 11/12/2003, you wrote: > > >On Dec 11, 2003, at 11:49 AM, [EMAIL PROTECTED] wrote: > >[..] > >> there is probably a much better way of doing all this i am working on > >>the checkResults sub. > >>it should find the pollerAudit log created by the main process > >>(discover) the file format for the log file is > >>pollerAudit.M.D.Y.h.m.s.lan (MDYhms being month day year hrs min sec) > >[..] > > > >This Might be a good time to step back and > >look at this problem in terms of 'algorithm' > >then worry about the code side. Since, while, > >yes, I can 'read' your code, it may help to begin > >with 'what do you really want/need'? > > > >You are passing in two time values into a function, > >so that you can try to find the 'files' that would > >be made between those times, yes? In particular, > >you are looking for the most recent one, yes? > > yes this is right i need the most recent one... as after the log is written it takes > a few or more seconds for the command to return. > the "discover" or delta can be from a few seconds to a few minits (depending on the > number of elements configured on the device) > > > > >IF you only need the most recent one, then your basic > >iteration loop could be simplified with say > > > > for ( my ($fTime) = $highFileName; $fTime = $lowFileName; $fTime--) > > { > > #my($fullFileName)="pollerAudit.$fileDate.$_.log"; > > # make one substitution > > my($fullFileName)="/$NH_HOME/log/pollerAudit.$fileDate.$fTime.log"; > > if (-e "$fullFileName") { > > open UPDATELOG, "$fullFileName"; > > my($reslutsLog) = <UPDATELOG>; > > close UPDATELOG; > > last; # break out of the loop we found one > > }; > > }; >
foreach my $fTime ( reverse $lowFileName .. $highFileName ) { : } will implement the loop you wanted. I don't guarantee that this is the way to go though! HTH, Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>