in reply to Re: perl not going to error path
in thread perl not going to error path

Oh my, i thought putting the quote around the file handle works but it does not. even when i send a numeric offset putting a quote around file handle goes to die. I guess i should not put quote around file handle. So i should check to make sure that the value is numeric before passing it to seek.

hopefully there is a way to check and die if it is non numeric with a non zero exit code. I will look around. thanks

Replies are listed 'Best First'.
Re^3: perl not going to error path
by stevieb (Canon) on Jan 23, 2016 at 18:21 UTC
    "So i should check to make sure that the value is numeric before passing it to seek"

    You can, yes. Doing it this way will allow you to handle the error yourself:

    my $offset = 'blah'; if ($offset =~ /^[0-9]+$/){ seek $fh, $offset, 0; } else { die "offset needs to be numeric"; }