Re: Subroutine example

2001-09-10 Thread Randal L. Schwartz
> "Ron" == Ron Smith <[EMAIL PROTECTED]> writes: Ron> Is it just me, or does anyone out there notice that the example Ron> subroutine on pg. 57 of "Learning Perl" (Third Edition) doesn't work, Ron> as presented? Ron> When written like: Ron> snip-- Ron> #!/usr/

Re: Subroutine example

2001-09-10 Thread Ron Smith
Thanks, everybody!! I've declared the $n variable outside the subroutine, as suggested, and everything works fine :-). Ron >From: "Ron Smith" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: Subroutine example >Date: Mon, 10 Sep 2001 14:23:28 -0700 >

Re: Subroutine example

2001-09-10 Thread Matthew Galloway
I believe when you have sub marine{ my $n } my is local to sub marine, so it is lost after each call of marine. Whereas in the second example you have my $n outside of sub marine. matt Ron Smith wrote: > Is it just me, or does anyone out there notice that the example subroutine > on pg.

Subroutine example

2001-09-10 Thread Ron Smith
Is it just me, or does anyone out there notice that the example subroutine on pg. 57 of "Learning Perl" (Third Edition) doesn't work, as presented? When written like: snip-- #!/usr/bin/perl -w use strict; sub marine { my $n += 1; # Global variable $n prin