Alternative to goto

2011-04-13 Thread Owen Chavez
I'm writing a script for work that navigates users through a complex decision-making tree, where decisions are made based on some fairly in-depth processing of data entered by the user. The script runs really well, does exactly what we need it to do. I'm having some trouble with the humans using

Subroutine question: Placement of subroutine definitions matter?

2010-10-30 Thread Owen Chavez
A straightforward question I hope. Can someone explain why the following code runs without a hitch: #!C:/strawberry/perl/bin/perl.exe use strict; use warnings; my $testvar = "TEST"; &testsub1(); sub testsub1 { print "The following should read \"TEST\": $testvar \n"; } ... while this throws u

Disadvantages of "our" v. "my" when declaring variables

2010-10-15 Thread Owen Chavez
Hello, I've started experimenting with the use of subroutines in place of large, repeating blocks of code in a few of my programs. Without exception, these subroutines require variables defined outside of the subroutine. Unless I'm mistaken, the only way to make these variables available within

Alternative to while ()

2010-09-29 Thread Owen Chavez
Hey y'all, I suspect that I'm struggling with something that has a *really* straightforward alternative, but I don't do a lot of programming in perl (or any other language, really), and I can't see it. I've got a block of code that I'd like to run in a loop until a user enters some desired input.

Re: Pattern matching problem - Why won't this work?

2010-04-12 Thread Owen Chavez
mming Perl (3rd) and it's not entirely clear to me how to proceed with a hash. Owen On Mon, Apr 12, 2010 at 10:11 PM, Peter Scott wrote: > On Mon, 12 Apr 2010 21:06:58 -0500, Owen Chavez wrote: > > I have a pattern matching question using Perl 5.10, Windows 7. Suppose > >

Pattern matching problem - Why won't this work?

2010-04-12 Thread Owen Chavez
e second "I" although I've included the /g modifier. Can anyone tell me why? How can I accomplish this? Owen Chavez