Re: Shift Question

2005-09-27 Thread Chris Devers
On Tue, 27 Sep 2005, Dave Adams wrote: > What is the purpose of the line "my $msg = shift;"? In the context of subroutines, it copies the first scalar argument passed to the routine to the variable $msg. If more than one argument was passed, the others aren't touched by this statement -- as yo

Re: Shift Question

2005-09-27 Thread John W. Krahn
Mulander wrote: > If I understood you question properly you want to know why people use > shift in subrutines and how does shift work. > > I will try to make it short: > shift works on lists, it removes the first element of the list perldoc -q "What is the difference between a list and an array"

Re: Shift Question

2005-09-27 Thread Wiggins d'Anconia
Mulander wrote: > If I understood you question properly you want to know why people use > shift in subrutines and how does shift work. > > I will try to make it short: > shift works on lists, it removes the first element of the list ( the 0 > indexed element ) and returns it as a lvalue ( if there

Shift Question

2005-09-27 Thread Mulander
If I understood you question properly you want to know why people use shift in subrutines and how does shift work. I will try to make it short: shift works on lists, it removes the first element of the list ( the 0 indexed element ) and returns it as a lvalue ( if there are no more elements in a l

RE: Shift Question

2005-09-27 Thread Ryan Frantz
> -Original Message- > From: Ryan Frantz > Sent: Tuesday, September 27, 2005 5:27 PM > To: Dave Adams; beginners perl > Subject: RE: Shift Question > > > > > -Original Message- > > From: Dave Adams [mailto:[EMAIL PROTECTED] > > Sent:

RE: Shift Question

2005-09-27 Thread Ryan Frantz
> -Original Message- > From: Dave Adams [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 27, 2005 5:17 PM > To: beginners perl > Subject: Shift Question > > QUESTION: What is the purpose of the line "my $msg = shift;"? I am > guessing it is for the

Shift Question

2005-09-27 Thread Dave Adams
QUESTION: What is the purpose of the line "my $msg = shift;"? I am guessing it is for the @_ array but what list element is there to be shifted off? It seems that the shift function is in a lot of subroutines and I am confused as to their purpose. #!/bin/perl -w (my $PROGNAME = $0) =~ s/^.*\///;

Re: shift question

2004-08-30 Thread John W. Krahn
[EMAIL PROTECTED] wrote: I found this in a template for creating subroutines, this is the base that is created when you use the template to create the subroutine. So now the newbie part, why would you place "my $par1 = shift;" in the subroutine template, and what does it do?? Basically I am trying

RE: shift question

2004-08-30 Thread Moon, John
Subject: RE: shift question [EMAIL PROTECTED] wrote: > Ok fantastic, I totally understand that, and if there were going to be > more than one thing passed, just insert $par2 = shift; on the next > line and then the second argument is in $par2, I assume.right?? Yes. You might al

RE: shift question

2004-08-30 Thread Wiggins d Anconia
> [EMAIL PROTECTED] wrote: > > Ok fantastic, I totally understand that, and if there were going to be > > more than one thing passed, just insert $par2 = shift; on the next > > line and then the second argument is in $par2, I assume.right?? > > Yes. > > You might also see it this way: > >

RE: shift question

2004-08-30 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > Ok fantastic, I totally understand that, and if there were going to be > more than one thing passed, just insert $par2 = shift; on the next > line and then the second argument is in $par2, I assume.right?? Yes. You might also see it this way: my ($par1, $par2) =

RE: shift question

2004-08-30 Thread christopher . l . hood
please notify the sender immediately and delete the message. -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Monday, August 30, 2004 2:41 PM To: Christopher L. Hood; [EMAIL PROTECTED] Subject: RE: shift question [EMAIL PROTECTED] wrote: > OK here comes the new

RE: shift question

2004-08-30 Thread Bob Showalter
[EMAIL PROTECTED] wrote: > OK here comes the newbie question. > > I found this in a template for creating subroutines, this is the base > that is created when you use the template to create the subroutine. > > So now the newbie part, why would you place "my $par1 = shift;" in > the subroutine te

shift question

2004-08-30 Thread christopher . l . hood
OK here comes the newbie question. I found this in a template for creating subroutines, this is the base that is created when you use the template to create the subroutine. So now the newbie part, why would you place "my $par1 = shift;" in the subroutine template, and what does it do?? Basicall

Re: Shift question...

2001-12-21 Thread Michael R. Wolf
Wim De Hul <[EMAIL PROTECTED]> writes: > my $var = shift; > > I thought that shift puts a variable in an array? What does this mean? Did you check the documentation on "shift" *before* posting the question? >From "Programming Perl": 3.2.143 shift shift ARRAY shift This fu

RE: Shift question...

2001-12-20 Thread Bob Showalter
> -Original Message- > From: Wim De Hul [mailto:[EMAIL PROTECTED]] > Sent: Thursday, December 20, 2001 10:48 AM > To: [EMAIL PROTECTED] > Subject: Shift question... > > > Hello guys ( and girls), > > While I was reading a script, I saw the lines: >

Re: Shift question...

2001-12-20 Thread Michael Stidham
;From: Wim De Hul <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Shift question... >Date: Thu, 20 Dec 2001 16:48:16 +0100 > >Hello guys ( and girls), > >While I was reading a script, I saw the lines: > >my $var = shift; > >I thought that shift puts a

RE: Shift question...

2001-12-20 Thread John Edwards
om: Wim De Hul [mailto:[EMAIL PROTECTED]] Sent: 20 December 2001 15:48 To: [EMAIL PROTECTED] Subject: Shift question... Hello guys ( and girls), While I was reading a script, I saw the lines: my $var = shift; I thought that shift puts a variable in an array? What does this mean? Thanks, Wim.

Shift question...

2001-12-20 Thread Wim De Hul
Hello guys ( and girls), While I was reading a script, I saw the lines: my $var = shift; I thought that shift puts a variable in an array? What does this mean? Thanks, Wim. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]