Re[2]: "lazy" variable declaration

2002-06-15 Thread Daniel Gardner
Could be that someone would be interested in this thread from fwp: http:[EMAIL PROTECTED]/msg02488.html Friday, June 14, 2002, 9:23:43 PM, Chas Owens wrote: > On Fri, 2002-06-14 at 15:50, todd r wade wrote: >> >> >> Chas Owens wrote: >> >> >> > >> >> Alternately, you could say: >> >> >> >

RE: "lazy" variable declaration

2002-06-14 Thread Chas Owens
> This is one of the reasons I gave up on "-w" a long time ago. You had > to program around the $^%&@ "use of undefined value" warning constantly. > > Of course, Perl 5.6 introduced the "no warnings qw(uninitialized);" > construct, which helps that problem, at the expense of some typing... I o

Re: "lazy" variable declaration

2002-06-14 Thread Chas Owens
On Fri, 2002-06-14 at 15:50, todd r wade wrote: > > > Chas Owens wrote: > > > > > >> Alternately, you could say: > >> > >> $track ||= ''; > >> > >> right before the next time you use foo after the split. I dont know > why this > >> works offhand, I just remember reading in the docs somewher

RE: "lazy" variable declaration

2002-06-14 Thread Bob Showalter
> -Original Message- > From: todd r wade [mailto:[EMAIL PROTECTED]] > Sent: Friday, June 14, 2002 3:51 PM > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: "lazy" variable declaration > > ... > Your examples are neither equivalent no

Re: "lazy" variable declaration

2002-06-14 Thread todd r wade
Chas Owens wrote: > >> Alternately, you could say: >> >> $track ||= ''; >> >> right before the next time you use foo after the split. I dont know why this >> works offhand, I just remember reading in the docs somewhere that its exempt >> from warnings. But for me, that is crossing over int

Re: "lazy" variable declaration

2002-06-14 Thread Chas Owens
> Alternately, you could say: > > $track ||= ''; > > right before the next time you use foo after the split. I dont know why this > works offhand, I just remember reading in the docs somewhere that its exempt > from warnings. But for me, that is crossing over into the land of ugly =0). $track

Re: "lazy" variable declaration

2002-06-13 Thread Todd Wade
"David T-G" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hmmm... Well, I'll grant you that, but what about the example above? It > would only be undef for the first N lines that are short, and once it > gets loaded then it will get reset instead. It seems

Re: "lazy" variable declaration

2002-06-13 Thread Todd Wade
"Janek Schleicher" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > use strict; use warnings; wasn't made only to make the Perl Community luckier. > It can help to avoid typical mistakes like > (a) mispelling of a variable > (b) using of an undefined variab

Re: "lazy" variable declaration

2002-06-12 Thread drieux
On Wednesday, June 12, 2002, at 06:39 , David T-G wrote: [..] > my # vars we will use > ( > $m3u, # file name > $mp3, # disk label > $source,$host,

Re: "lazy" variable declaration

2002-06-12 Thread David T-G
Janek, et al -- ...and then Janek Schleicher said... % % David T-G wrote at Wed, 12 Jun 2002 21:50:12 +0200: % % > % I would try to write it as % > % while (<>) { % > %my ($artist, $album, $track) = split m:/:; % > %if ($track eq $foo) { # $foo eq "$foo" :-) % > % ... % > %}

Re: "lazy" variable declaration

2002-06-12 Thread Deb
David, Could you turn off your MUA's option for sending your email messages out as "quoted-printable"? Reading your posts has been difficult at best on an xterm where there is no MIME. (see included text, below) It seems you're using mutt as an MUA - I think you should be able to configure it

Re: "lazy" variable declaration

2002-06-12 Thread Janek Schleicher
David T-G wrote at Wed, 12 Jun 2002 21:50:12 +0200: > % I would try to write it as > % while (<>) { > %my ($artist, $album, $track) = split m:/:; > %if ($track eq $foo) { # $foo eq "$foo" :-) > % ... > %} > % } > > I don't see a difference here except that you're using a vari

Re: "lazy" variable declaration

2002-06-12 Thread David T-G
Janek, et al -- ...and then Janek Schleicher said... % % David T-G wrote at Wed, 12 Jun 2002 19:42:46 +0200: % ... % > % > In this limited context, yes. I wouldn't usually declare them all up front. % % Well, I thought you never do (as I know you're not a beginner any more) Oh, I'm still a

Re: "lazy" variable declaration

2002-06-12 Thread Janek Schleicher
David T-G wrote at Wed, 12 Jun 2002 19:42:46 +0200: > ... > % - Now Perl's complaining about many no declared variables. % - You declare >them all at the > beginning. > > In this limited context, yes. I wouldn't usually declare them all up front. > Well, I thought you never do (as I know

Re: "lazy" variable declaration

2002-06-12 Thread David T-G
Janek, et al -- ...and then Janek Schleicher said... % % David T-G wrote at Wed, 12 Jun 2002 15:39:41 +0200: % % > I'm trying to be good and so I use "my $variable" rather than making them global, and I prefer to ... % % Wait a moment. % It seems like that: % - You want to write Perl script

Re: "lazy" variable declaration

2002-06-12 Thread Janek Schleicher
David T-G wrote at Wed, 12 Jun 2002 15:39:41 +0200: > I'm trying to be good and so I use "my $variable" rather than making them global, >and I prefer to > not stick little [potentially-confusing] "my" declarations around through the code >so I declare my > vars up front. While some of them migh

you can't be lazy, that's why! (was "Re: "lazy" variable declaration")

2002-06-12 Thread David T-G
Hi again -- ...and then David T-G said... % % I'm trying to be good and so I use "my $variable" rather than making them % global, and I prefer to not stick little [potentially-confusing] "my" % declarations around through the code so I declare my vars up front. I wasn't terribly clear here...

RE: "lazy" variable declaration

2002-06-12 Thread Bob Showalter
> -Original Message- > From: David T-G [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, June 12, 2002 9:40 AM > To: perl beginners > Subject: "lazy" variable declaration > > > Hi, all -- > > I'm trying to be good and so I use "my $va

Re: "lazy" variable declaration

2002-06-12 Thread Jenda Krynicky
> I'm trying to be good and so I use "my $variable" rather than making > them global, and I prefer to not stick little [potentially-confusing] > "my" declarations around through the code so I declare my vars up > front. This is a matter of personal taste, but they should not be too far "up fron

Re: "lazy" variable declaration

2002-06-12 Thread Felix Geerinckx
on Wed, 12 Jun 2002 13:39:41 GMT, [EMAIL PROTECTED] (David T-G) wrote: > Hi, all -- > > I'm trying to be good and so I use "my $variable" rather than > making them global, and I prefer to not stick little > [potentially-confusing] "my" declarations around through the code > so I declare my vars

"lazy" variable declaration

2002-06-12 Thread David T-G
Hi, all -- I'm trying to be good and so I use "my $variable" rather than making them global, and I prefer to not stick little [potentially-confusing] "my" declarations around through the code so I declare my vars up front. While some of them might usefully be pre-filled, many of them can happily