Re: excluding undefined variables

2010-12-12 Thread shawn wilson
On Mon, Dec 13, 2010 at 1:05 AM, John W. Krahn wrote: > shawn wilson wrote: >> >> i'm trying to exclude undefined variables for that are to be put into >> a sql database date field, but none of this is working: >> >> sub correctdate {             # make valid

Re: excluding undefined variables

2010-12-12 Thread John W. Krahn
shawn wilson wrote: i'm trying to exclude undefined variables for that are to be put into a sql database date field, but none of this is working: sub correctdate { # make valid sql DATE field my $date = $_[ 0 ]; my ($month, $day, $year) = split / /, $date if defined(

Re: excluding undefined variables

2010-12-12 Thread Brian Fraser
You are declaring $corrected within the if block -- After it ends, the variable goes out of scope, making a strict[0] Perl blow up in your face. As you have warnings enabled, it shows that message (which you can look up in perldiag is you don't quite get [1]). The solution is simple: You just need

Re: excluding undefined variables

2010-12-12 Thread shawn wilson
On Sun, Dec 12, 2010 at 8:11 PM, shawn wilson wrote: > i'm trying to exclude undefined variables for that are to be put into > a sql database date field, but none of this is working: errr, sorry, my error with the current code is: Global symbol "$corrected" requires exp

excluding undefined variables

2010-12-12 Thread shawn wilson
i'm trying to exclude undefined variables for that are to be put into a sql database date field, but none of this is working: sub correctdate { # make valid sql DATE field my $date = $_[ 0 ]; my ($month, $day, $year) = split / /, $date if defined( $date ); $day =~ s/,/

Re: undefined variables

2003-02-18 Thread Paul
--- Bryan Harris <[EMAIL PROTECTED]> wrote: > Wild, I had no idea perl supported all these notations... LOL!!! There are more TMTOWTDI: There's More Than One Way To Do It. > >> I'd like to concatenate two variables-- > >> $newVar = $old1 . $old2; > >> -- where $old1 might be undefined. Is t

Re: undefined variables

2003-02-17 Thread Paul
--- Bryan Harris <[EMAIL PROTECTED]> wrote: > >> I'd like to concatenate two variables-- > >> $newVar = $old1 . $old2; > >> -- where $old1 might be undefined. Is there any way to set a flag > >> so that this just results in $old2 instead of the compiler throwing > >> an error? > > > > The concate

Re: undefined variables

2003-02-17 Thread Rob Dixon
Rob Dixon wrote: > Bryan Harris wrote: > > > > I'd like to concatenate two variables-- > > > > > > > > $newVar = $old1 . $old2; > > > > > > > > -- where $old1 might be undefined. Is there any way to set a > > > > flag so that this just results in $old2 instead of the compiler > > > > throwing an e

Re: undefined variables

2003-02-17 Thread Rob Dixon
Bryan Harris wrote: > > > I'd like to concatenate two variables-- > > > > > > $newVar = $old1 . $old2; > > > > > > -- where $old1 might be undefined. Is there any way to set a > > > flag so that this just results in $old2 instead of the compiler > > > throwing an error? > > > > The concatenation o

Re: undefined variables

2003-02-17 Thread Jenda Krynicky
From: Bryan Harris <[EMAIL PROTECTED]> > I'd like to concatenate two variables-- > > $newVar = $old1 . $old2; > > -- where $old1 might be undefined. Is there any way to set a flag so > that this just results in $old2 instead of the compiler throwing an > error? It's not an error, but a warning.

Re: undefined variables

2003-02-17 Thread Bryan Harris
>> I'd like to concatenate two variables-- >> >> $newVar = $old1 . $old2; >> >> -- where $old1 might be undefined. Is there any way to set a flag so >> that this just results in $old2 instead of the compiler throwing an >> error? > > The concatenation operator will work fine with an undefined

Re: undefined variables

2003-02-17 Thread Rob Dixon
Bryan Harris wrote: > I'd like to concatenate two variables-- > > $newVar = $old1 . $old2; > > -- where $old1 might be undefined. Is there any way to set a flag so > that this just results in $old2 instead of the compiler throwing an > error? The concatenation operator will work fine with an unde

undefined variables

2003-02-17 Thread Bryan Harris
I'd like to concatenate two variables-- $newVar = $old1 . $old2; -- where $old1 might be undefined. Is there any way to set a flag so that this just results in $old2 instead of the compiler throwing an error? (This is a gross simplification of the problem, I'd rather not check to see if it's