Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Beginning of file search

by phathead22 (Novice)
on Apr 27, 2001 at 19:17 UTC ( #76138=perlquestion: print w/replies, xml ) Need Help??

phathead22 has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
(Ovid - requirements) Re: Beginning of file search
by Ovid (Cardinal) on Apr 27, 2001 at 20:23 UTC
    If I may suggest a strategy: pretend that we know absolutely nothing about computers, but are instead going to describe the situation to someone else. The other person will respond and then we tell you what they said.

    What happens here is that if you want a useful answer, without a bunch of monks taking wild shots, you're forced to explain explicitly what you need. For example:

    • After my program has read in several lines from a file, is there a way I can get it to start reading from the beginning of the file without closing and then reopening it?
    • After I open a file, How do I just read X amount of lines/characters/bytes, etc.
    • I accidentally shot my boss. Can anyone tell me where I can download the Evidence::Conceal module?
    Interestingly, one of the reasons that so many monks insist upon "Seekers" posting there code is not because they need to see the code to tell the Seeker what is going on. Rather, many monks ask for the code because the Seeker has not been able to explain what /s?he/ really needs. This is unfortunate because then, the code that we see may innacurately reflect the Seekers needs, but it is the best we can do.

    Please don't take this personally. If our answers above didn't help you, perhaps reword your question or (dare I say it?) post any code sample you have.

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

Re: Beginning of file search
by zigster (Hermit) on Apr 27, 2001 at 19:23 UTC
    To reposition the file-pos indicator use seek in IO::Seekable something like  seek (FHANDLE,0,SEEK_SET) HTH
    --

    Zigster
Re: Beginning of file search
by jeroenes (Priest) on Apr 27, 2001 at 19:22 UTC
    seek:
          seek FILE, 0, 0;
Re: Beginning of file search
by suaveant (Parson) on Apr 27, 2001 at 19:19 UTC
    What do you mean by the beginning of a file? The first line, first ten lines? Inode number?
                    - Ant

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://76138]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-05-28 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?