Re: Using $_ in a function if no argument is passed
From: Paul Johnson (paul_at_pjcj.net)
Date: 04/02/04
- Previous message: Smoot Carl-Mitchell: "Re: Using $_ in a function if no argument is passed"
- In reply to: Beau E. Cox: "Re: Using $_ in a function if no argument is passed"
- Next in thread: R. Joseph Newton: "Re: Using $_ in a function if no argument is passed"
- Reply: R. Joseph Newton: "Re: Using $_ in a function if no argument is passed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 2 Apr 2004 19:36:04 +0200 To: "Beau E. Cox" <beau@beaucox.com>
On Fri, Apr 02, 2004 at 07:18:25AM -1000, Beau E. Cox wrote:
> sub to_upper
> {
> # point to passed arg or caller's $_
> my $arg = $_[0] ? \$_[0] : \$_;
my $arg = @_ ? \$_[0] : \$_;
> # modify in place
> $$arg = uc $$arg;
> }
$_ = "Leave me alone!";
$s = "0";
to_upper $s;
-- Paul Johnson - paul@pjcj.net http://www.pjcj.net
- Previous message: Smoot Carl-Mitchell: "Re: Using $_ in a function if no argument is passed"
- In reply to: Beau E. Cox: "Re: Using $_ in a function if no argument is passed"
- Next in thread: R. Joseph Newton: "Re: Using $_ in a function if no argument is passed"
- Reply: R. Joseph Newton: "Re: Using $_ in a function if no argument is passed"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]