in reply to Scope and Context
I don't think the map is a big deal here, since you want the return value. I'm not sure it's worth messing around with sysopen though (I've never needed to use it, so I don't even know if it still works the way I rearranged it), and hard-coding the constant "8" is probably not a good idea either. I expect you know all this and were just posting to point out other things, but maybe someone else reading this didn't.my @matches = get_matches($file); sub get_matches { my $file = shift; return unless (-e $file && -r _); local *FH; sysopen FH, $file, O_RDONLY; flock FH, 8; map { chomp; qr/$_/ } <FH>; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Scope and Context
by rob_au (Abbot) on Nov 14, 2001 at 07:02 UTC | |
by perrin (Chancellor) on Nov 14, 2001 at 07:13 UTC | |
by pdcawley (Hermit) on Nov 14, 2001 at 20:02 UTC |