Kelly Jones wrote:
If I do a for loop in a subroutine, do I have to declare it private
with my()? I always though for() did that for me, but I ran into a bug
where code like this:
sub foo {for $i (1..2) {print $i;}}
affected my global $i (I think). Or was I imagining it?
The variable in a for
Kelly Jones wrote:
If I do a for loop in a subroutine, do I have to declare it private
with my()? I always though for() did that for me, but I ran into a bug
where code like this:
sub foo {for $i (1..2) {print $i;}}
affected my global $i (I think). Or was I imagining it?
Probably, since $i ou
If I do a for loop in a subroutine, do I have to declare it private
with my()? I always though for() did that for me, but I ran into a bug
where code like this:
sub foo {for $i (1..2) {print $i;}}
affected my global $i (I think). Or was I imagining it?
--
We're just a Bunch Of Regular Guys, a c
Thomas H. George wrote:
> The difficulty is in the next to last line, the 'unless ...'
> statement which causes warning:
> Use of uninitialized value in string eq at chap4-take6.pl line 49.
Some debugging hints:
1. Set the output autoflush ($|) Perl variable to a true value near the
top of your
Thomas H. George wrote:
I am inching my way through INTERMEDIATE PERL and tried using hashes to
solve Chapter 4, Problem 2. I never used hashes before but my attempted
solution convinced me of their value as contrasted to the solution with
arrays.
The Problem: My solution works but with an err
Hope this helps you...
#!/usr/bin/perl -w
# formatted with perltidy
use warnings;# I always use this
use strict;
my %required_list = (
life_jacket => 'preserver',
lotion => 'sunscreen',
water => 'water_bottle',
coat=> 'jacket',
);
my %captain = (
name
I am inching my way through INTERMEDIATE PERL and tried using hashes to
solve Chapter 4, Problem 2. I never used hashes before but my attempted
solution convinced me of their value as contrasted to the solution with
arrays.
The Problem: My solution works but with an error I can't eliminate.
The