Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
I can't replicate the behaviour with "non numeric" equal to string, reference, or object:
#!/usr/bin/perl use warnings; use strict; my $filename = __FILE__; my %offset_type = ( number => 1, string => 'abc', reference => { a => 23 }, object => bless do { \ my $object }, 'Class' ); for my $type (keys %offset_type) { my $offset = $offset_type{$type}; open my $FH, '<', $filename or die $!; eval { warn "$type without quotes\n"; seek $FH, $offset, 0 or die "Report error - $!"; warn "quoted $type\n"; seek "$FH", $offset, 0 or die "Report error - $!"; 1 } or warn $@; }

Update: Adding output:

number without quotes quoted number seek() on unopened filehandle at ./1.pl line 21. Report error - Bad file descriptor at ./1.pl line 21. reference without quotes quoted reference seek() on unopened filehandle at ./1.pl line 21. Report error - Bad file descriptor at ./1.pl line 21. string without quotes Argument "abc" isn't numeric in seek at ./1.pl line 19. quoted string seek() on unopened filehandle at ./1.pl line 21. Report error - Bad file descriptor at ./1.pl line 21. object without quotes quoted object seek() on unopened filehandle at ./1.pl line 21. Report error - Bad file descriptor at ./1.pl line 21.

Please, read Short, Self Contained, Correct Example on how to post helpful code.

If you need to check whether something is a number, use Scalar::Util's looks_like_number.

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

In reply to Re: perl not going to error path by choroba
in thread perl not going to error path by gupr1980

Title:
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?
Username:
Password:

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

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



    Results (101 votes). Check out past polls.

    Notices?