Re: Subroutine and @_ confusion

2004-04-05 Thread WilliamGunther
In a message dated 4/5/2004 11:25:56 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: >I have seen shift used in Subroutines like: "NumberOfApples = >shift(@_);", >any reason for writing the subroutine that way? You'll frequently see shift in subs. Like "$class = shift;" (Default for shift i

Re: Subroutine and @_ confusion

2004-04-05 Thread Angie Ahl
Thanks Will & Bob. using $class->FindLink(LinkID => $LinkID); has fixed it. I needed to use it for every internal call to a subroutine within my package and I'm now getting exactly what I needed. For the archives purpose, use &subroutine_name instead of $class->subroutine_name passed the @_ th

Re: Subroutine and @_ confusion

2004-04-05 Thread gohaku
On Apr 5, 2004, at 9:40 AM, [EMAIL PROTECTED] wrote: In a message dated 4/5/2004 7:52:33 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: Hi People I'm trying to get a grip on passing @_ to subroutines. Or rather NOT passing it. I have a package: sub HLOM::Links::new { my ($class, %arg) =

RE: Subroutine and @_ confusion

2004-04-05 Thread Bob Showalter
Angie Ahl wrote: > ... > These subroutines are called externally ie > HLOM::Links->FindLink(LinkID => $id); > > but also internally ie &FindLink(LinkID => $id); > > I read in Perlsub that doing &FindLink will pass the current @_ to the > subroutine. Great. Only if you omit the argument list as

Re: Subroutine and @_ confusion

2004-04-05 Thread WilliamGunther
In a message dated 4/5/2004 7:52:33 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: >Hi People > >I'm trying to get a grip on passing @_ to subroutines. Or rather NOT >passing it. > >I have a package: > >sub HLOM::Links::new { >my ($class, %arg) = @_; >my $userid = 0; >if ($arg{use

Subroutine and @_ confusion

2004-04-05 Thread Angie Ahl
Hi People I'm trying to get a grip on passing @_ to subroutines. Or rather NOT passing it. I have a package: sub HLOM::Links::new { my ($class, %arg) = @_; my $userid = 0; if ($arg{userid}) {$userid = int $arg{userid};} bless { _UserID => $userid,