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

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
"Now when i pass a non numeric offset, i get an error that says argument non numeric but i dont get the die error message"

That's because seek is effectively calling die() before you get a chance to. It's saying "pass in an integer or I'll proceed no further. This is an error, and I'm killing all processes".

It's hard to get seek to fail when your argument is an integer, because (at least on Unix), it allows you to seek past the end of the file.

This sounds like an XY Problem. Why don't you tell us what it is you're trying to do? seek() as you've noticed, handles its own errors.


"now when i pass a non numeric offset, the script dies and throws the die error message and the exit value is non zero. this is what i want but i don't understand why i need the quotes."

Well, you didn't include the error message from $!, but I'll bet it's something along these lines: "Bad file descriptor...". You've hit your die, but it's because quoted "$fh" is no longer a valid file handle anymore. It's pretty much saying that it can't open the file.

Again, tell us what you're really trying to do in the bigger picture.

In reply to Re^3: perl not going to error path by stevieb
in thread perl not going to error path by gupr1980

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-06-28 06:35 GMT
Find Nodes?
    Voting Booth?
    My most frequent journeys are powered by:

    Results (90 votes). Check out past polls.