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

What's the bug ?

by chiburashka (Initiate)
on Jul 07, 2004 at 20:50 UTC ( #372541=perlquestion: print w/replies, xml ) Need Help??

chiburashka 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'.
Re: What's the bug ?
by tcf22 (Priest) on Jul 07, 2004 at 20:52 UTC
    You need to create a Net::IP object. Try this
    #!/usr/local/bin/perl use strict; use Net::IP; my $ip = new Net::IP('193.0.1/24') or die (Net::IP::Error()); print ("Mask : ", $ip->mask());
    PS. using strict would have prevented this error.

    Update: Added IP in constructor. Directly from CPAN.

    - Tom

Re: What's the bug ?
by tomhukins (Curate) on Jul 08, 2004 at 00:24 UTC

    Imagine you wrote the following:

    #!/usr/local/bin/perl print $message;

    $message is undefined, so print will output nothing. If you use the strict pragma, it will complain alert you that you forgot to define $message.

    The same thing is happening in your program. You try to do something with $ip before you have declared it. In this case, you need to instantiate $ip as a Net::IP object as suggested by tcf22.

Re: What's the bug ?
by Anonymous Monk on Jul 07, 2004 at 22:09 UTC
    Now, how to fix it ?
    You open your eyes and RTFM

    Considered: tomhukins delete: no useful content
    Unconsidered: ysth - Keep/Edit/Delete = 12/0/9 - enough keep votes

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2023-01-27 20:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?