monkey_boy has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I've just been bitten by this feature of perl:
I expected that $/ would be package specific, it doesnt seem to be,
My question is , how best to avoid this mistake or is there a way to alter the behaviour of $/ to make it package specific?
Many Thanks, Ian (monkey_boy)
This is not a Signature...
I've just been bitten by this feature of perl:
#!/usr/bin/perl use strict; use warnings; { local $/ = 'Foo'; my $obj = SomePackage->new; }; package SomePackage; sub new { my ($class) = shift; print "Whats the separator?: $/ :\n"; return bless {} , $class; };
I expected that $/ would be package specific, it doesnt seem to be,
My question is , how best to avoid this mistake or is there a way to alter the behaviour of $/ to make it package specific?
Many Thanks, Ian (monkey_boy)
This is not a Signature...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: non-global $/
by halley (Prior) on Jun 22, 2005 at 13:37 UTC | |
Re: non-global $/
by hanenkamp (Pilgrim) on Jun 22, 2005 at 13:44 UTC | |
Re: non-global $/
by tlm (Prior) on Jun 22, 2005 at 14:11 UTC | |
Re: non-global $/
by trammell (Priest) on Jun 22, 2005 at 14:11 UTC | |
Re: non-global $/
by broquaint (Abbot) on Jun 22, 2005 at 15:01 UTC | |
Re: non-global $/
by Ultra (Hermit) on Jun 22, 2005 at 13:49 UTC | |
by Jenda (Abbot) on Jun 22, 2005 at 15:33 UTC | |
by Ultra (Hermit) on Jun 23, 2005 at 06:43 UTC | |
by monkey_boy (Priest) on Jun 23, 2005 at 09:01 UTC |
Back to
Seekers of Perl Wisdom