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??
Chris Hood Investigator Verizon Global Security Operations Center Email: [EMAIL PROTECTED] Desk: 972.399.5900 Verizon Proprietary NOTICE - This message and any attached files may contain information that is confidential and/or subject of legal privilege intended only for the use by the intended recipient. If you are not the intended recipient or the person responsible for delivering the message to the intended recipient, be advised that you have received this message in error and that any dissemination, copying or use of this message or attachment is strictly forbidden, as is the disclosure of the information therein. If you have received this message in error 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 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?? > > Basically I am trying to find out if I need to modify the template or > not. Any help would be greatly appreciated. > > Oh and btw I looked at the shift function and it applies to the @_ > array, which is not being used in this subroutine, and neither is > @par1 , so my only guess would be that the template is creating a > verifiably empty variable called $par1 . > > > > sub Irfan > { > my $par1 = shift; > > return ; > } # ---------- end of subroutine Irfan ---------- @_ holds the actual arguments passed to the subroutine call. So if you call the sub as: Irfan('foo'); Then inside the sub: my $par1 = shift; will assign the first argument ('foo'), to $par1 This is a very common idiom. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>