Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: exports -- which module exports are used? ($.)

by tye (Cardinal)
on Oct 03, 2013 at 17:08 UTC ( #1056777=note: print w/ replies, xml ) Need Help??


in reply to Re: exports -- which module exports are used?
in thread exports -- which module exports are used?

There is probably a better solution, and I suspect it has something to do with the seek.

Indeed. This is how I've fixed it:

$. = 0; seek $fh, 0, 0 or die "Can't rewind handle to $file: $!\n";

(Updated: Actually, you also have to move that code so that it gets run before 'print' (for example) gets called, which is required else $. would be tied to STDOUT.)

Alternately, you can do:

{ my $eof = <$fh>; $. = 0; } seek...

Or I could just open the file twice.

- tye        


Comment on Re^2: exports -- which module exports are used? ($.)
Select or Download Code
Re^3: exports -- which module exports are used? ($.)
by toolic (Chancellor) on Oct 03, 2013 at 17:24 UTC
    Thanks for the patch.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056777]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (16)
As of 2014-12-22 13:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (118 votes), past polls