"Mr. Shawn H. Corey" schreef:
> Inside a sub, shift without a parameter will shift @_. Outside a sub,
> it will shift @ARGV. Since it does two different things in different
> context, always give it a parameter. Things that do different things
> should look different.
I hardly ever use "shift"
In message <[EMAIL PROTECTED]>, Rob Dixon <[EMAIL PROTECTED]>
writes:
>Mr. Shawn H. Corey wrote:
>> "Real Perl Programmers prefer things to be visually distinct."
>> Larry Wall
>>
>> I wasn't the first to have the idea.
>
>I can't find anywhere where that is quoted in context.
Not quite that, bu
> Message du 01/10/08 13:08
> De : "Mr. Shawn H. Corey"
> A : "Jeff Pang"
> Copie à : "Rob Dixon" , "Perl Beginners"
> Objet : Re: Passing "class" objects to a function
>
>
> On Wed, 2008-10-01 at 05:04 +0200, Jeff Pan
On Wed, 2008-10-01 at 05:04 +0200, Jeff Pang wrote:
> For an experienced *Perl* programmer, using shift rather than shift @_
> is more comfortable and natural.
You have just proven my point. You have overlooked the fact the outside
a sub, shift without a parameter will shift @ARGV, not @_. Even
> Message du 01/10/08 02:54
> De : "Rob Dixon"
> A : "Perl Beginners"
> Copie à : "Mr. Shawn H. Corey"
> Objet : Re: Passing "class" objects to a function
>
>
> Mr. Shawn H. Corey wrote:
> > On Tue, 2008-09-30 at 22:5
Mr. Shawn H. Corey wrote:
On Wed, 2008-10-01 at 10:40 +0900, Raymond Wan wrote:
I don't think Shawn is fighting a losing battle...at least I agree
with him...maybe I'm on the "losing side". :-)
I know I'm fighting a losing battle. Computers hate me; I know this.
And someday they're g
On Wed, 2008-10-01 at 10:40 +0900, Raymond Wan wrote:
> I don't think Shawn is fighting a losing battle...at least I agree
> with him...maybe I'm on the "losing side". :-)
I know I'm fighting a losing battle. Computers hate me; I know this.
And someday they're going to do me in. ;)
--
Just
Hi all,
Paul Johnson wrote:
On Tue, Sep 30, 2008 at 11:40:21AM -0400, Mr. Shawn H. Corey wrote:
No.
Inside a sub, shift without a parameter will shift @_. Outside a sub,
it will shift @ARGV. Since it does two different things in different
context, always give it a parameter. Things th
On Wed, 2008-10-01 at 01:53 +0100, Rob Dixon wrote:
> Mr. Shawn H. Corey wrote:
> > On Tue, 2008-09-30 at 22:55 +0200, Paul Johnson wrote:
> >>>
> >>> Inside a sub, shift without a parameter will shift @_. Outside a sub,
> >>> it will shift @ARGV. Since it does two different things in different
>
Mr. Shawn H. Corey wrote:
> On Tue, 2008-09-30 at 22:55 +0200, Paul Johnson wrote:
>>>
>>> Inside a sub, shift without a parameter will shift @_. Outside a sub,
>>> it will shift @ARGV. Since it does two different things in different
>>> context, always give it a parameter. Things that do differ
On Tue, 2008-09-30 at 22:55 +0200, Paul Johnson wrote:
> > Inside a sub, shift without a parameter will shift @_. Outside a sub,
> > it will shift @ARGV. Since it does two different things in different
> > context, always give it a parameter. Things that do different things
> > should look diffe
On Tue, Sep 30, 2008 at 11:40:21AM -0400, Mr. Shawn H. Corey wrote:
> On Tue, 2008-09-30 at 23:17 +0800, Sandy lone wrote:
> > 2008/9/30 Vyacheslav Karamov <[EMAIL PROTECTED]>:
> >
> > > sub SomeFunc
> > > {
> > > my $node = shift @_;
> >
> > or:
> > my $node = shift;# shift get @_ as the d
On Tue, 2008-09-30 at 23:17 +0800, Sandy lone wrote:
> 2008/9/30 Vyacheslav Karamov <[EMAIL PROTECTED]>:
>
>
> >
> > I've made a mistake. Correct code:
> >
> > sub SomeFunc
> > {
> > my $node = shift @_;
>
>
> or:
> my $node = shift;# shift get @_ as the default arguments
No.
Inside a s
2008/9/30 Vyacheslav Karamov <[EMAIL PROTECTED]>:
>
> I've made a mistake. Correct code:
>
> sub SomeFunc
> {
> my $node = shift @_;
or:
my $node = shift;# shift get @_ as the default arguments
my ($node) = @_; # in list context, $node will get the first element of @_
--
Sandy
--
To
Mr. Shawn H. Corey пишет:
On Tue, 2008-09-30 at 17:30 +0300, Vyacheslav Karamov wrote:
Hi All!
I need to pass object to a function. How can I do it?
How to make this code work?
use Tree::Simple;
sub SomeFunc
{
my $node = @_;
foreach my $child ($node->getAllChildren() )
{
On Tue, 2008-09-30 at 17:30 +0300, Vyacheslav Karamov wrote:
> Hi All!
>
> I need to pass object to a function. How can I do it?
>
> How to make this code work?
>
> use Tree::Simple;
>
>
> sub SomeFunc
> {
> my $node = @_;
> foreach my $child ($node->getAllChildren() )
> {
>
Hi All!
I need to pass object to a function. How can I do it?
How to make this code work?
use Tree::Simple;
sub SomeFunc
{
my $node = @_;
foreach my $child ($node->getAllChildren() )
{
...
}
}
my $tree = Tree::Simple->new("tree", Tree::Simple->ROOT);
SomeFunc( $tree );
-
17 matches
Mail list logo