[boulder.pm] use strict, and net::ping

Walter Pienciak walter at frii.com
Fri Jul 14 13:26:54 CDT 2000


my $p    declares $p, returns $p
my ($p)  declares $p, returns a list with one element, $p

Basically, the ($p) puts it into a list context rather than
a plain old scalar context.

Walter

On Fri, 14 Jul 2000, jeff wrote:

> what's the difference between  'my $p' and 'my($p)'.
> 
> Walter Pienciak wrote:
> 
> > On Fri, 14 Jul 2000, Robert L. Harris wrote:
> >
> > > I'm doing a "use strict;" and trying to use net::ping.
> > >
> > > I have this:
> > >
> > > $p=Net::Ping->new("icmp",5,64);
> > > $Out=$p->ping($Target);
> > >
> > > needless to say, strict is complaining about $p not being declared,
> > > but if I do a "my ($p)" it gets rather unhappy.
> > >
> > > What's the best way to make this call?  I can't find a good example
> > > in PCB or the Camel that uses strict.
> > >
> > > I'd rather not remove the strict...
> > >
> > > Help?
> > >
> > > Robert
> >
> > Does
> >
> >     my $p = Net::Ping->new("icmp",5,64);
> >
> > get a complaint?
> >
> > Walter
> 
> --
> Jeff Saenz
> jeff at planetoid.net
> 
> 




More information about the Boulder-pm mailing list