Re: 2 digit numeric

2001-07-17 Thread iansmith
On Wed, 18 Jul 2001, Arvind Baldeo wrote: > I need to output my result as two digit numeric. Try: printf "%02d", $new; Look up printf and sprintf in the perlfunc manpage. -- Ian -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re[2]: A better way?

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Tim Musson wrote: > I am using the most recent from ActiveState, but I tend to stick the & > out there so I can tell at a glance that I am calling a sub. Does it > cause problems or is it just not needed? It doesn't cause any problems that I am aware of. Go ahead and use it

Re: A better way?

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Tim Musson wrote: > Is this a better way? > > if (($Var eq "String") || ($Var2 =~ /$STRING/)) { > &Sub($Var1); > } I usually write... if ($Var eq "String" or $Var2 =~ /$STRING/) { ...as I like the diffrent precidence of the 'or' operator. You can also leave off the & i

Re: How do I determine number of matches in a regex?

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Brett W. McCoy wrote: >There is no equivalent operator to force an >expression to be interpolated in list context >because in practice, this is never needed. If you >really wanted to do so, however, you could use

Re: How do I determine number of matches in a regex?

2001-06-22 Thread iansmith
Normally I'd be sorry for opening a can of worms, but this one was informative enough that I'm glad I did. :-) After thinking about it for a few minutes, I can't think of a use for list() that doesn't just count elements.. so it does seem like a rather useless addition.. and confusing too since t

RE: How do I determine number of matches in a regex?

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Brett W. McCoy wrote: > > On Fri, 22 Jun 2001, Paul wrote: > > > $count = () = /$pattern/g; > > > > This seems like a place that an array() operator like scalar() > > woudl be usefull. Then you could do '$count = array(/$pat/g);' > > instead. I know the above works well, bu

RE: How do I determine number of matches in a regex?

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Paul wrote: > $count = () = /$pattern/g; This seems like a place that an array() operator like scalar() woudl be usefull. Then you could do '$count = array(/$pat/g);' instead. I know the above works well, but it would be nice for completeness to have array() as well as sca

Perl IDE Reviews

2001-06-22 Thread iansmith
Anyone have a site that has reviews of Perl IDEs? Maybe we should make a list and put it in a FAQ if one does not exist. I have used... Perl Builder 2.0 - http://www.solutionsoft.com/pbeval.htm - Does not handle

RE: Komodo

2001-06-22 Thread iansmith
On Fri, 22 Jun 2001, Steve Howard wrote: > Komodo's beta's work OK, but they don't always recognize common PERL syntax > like opening a file. The previous Beta did work OK with debugging, etc, but > the current version does not. Actually, the previous version was tolerable, > but the current versi

Re: Reading versus Referencing Books

2001-06-15 Thread iansmith
On Fri, 15 Jun 2001, Michael D. Risser wrote: > I tend to read about the first 1/4 - 1/2 of a programming book to get the > basics down, after that it becomes a reference for me. "How do I do this > thing?" > > I don't think I have ever read cover to cover, though I probably would get a > much bet

Re: When to use "my"?

2001-06-15 Thread iansmith
On Fri, 15 Jun 2001, Gross, Stephan wrote: > One of the things I've been struck by on this list is how often the "my" > declaration is used. > For example, I never would have thought of > foreach my $i (@data) > What are the advantages to doing this? I would recomend the use of 'my' and 'use str

Re: Perl Scope Question

2001-06-10 Thread iansmith
On Sun, 10 Jun 2001, Charles Lu wrote: > Variable "%hash" will not stay shared I forgot to mention a few little details.. so here is your example code with the corrections to get rid of the unsharing problem. use strict; my @list = ('apple',12, 'peach', 2, 'pear', 45); &function_one(@list);

Re: Perl Scope Question

2001-06-10 Thread iansmith
On Sun, 10 Jun 2001, Charles Lu wrote: > When I run the following code with the Warning flag I get the following > message: > > Variable "%hash" will not stay shared This can be a dangerous situation. Perl is complaining because of the nested subroutine. The dangerous part is that it that t

Re: [META] Rants (was:Re: space)

2001-06-08 Thread iansmith
On Fri, 8 Jun 2001, Peter Scott wrote: > I use Eudora also, and it works just fine. To reply to the person who sent > the message, I hit Reply. To reply to that person and the list, I hit > Reply To All. To reply to just the list and not the sender would be rude, > but if I wanted to do it, I'd

Re: if then else

2001-06-08 Thread iansmith
On Fri, 8 Jun 2001, Luinrandir Hernson wrote: > if ($ENV{'HTTP_REFERER'} = "") >{$previous = "an unknown site"} >else >{$previous = "$ENV{'HTTP_REFERER'}}; Missing a terminating " on the last line there. You should use ; to end lines as well. Makes life easier when you a

Re: PERL module: Help please!

2001-06-08 Thread iansmith
On Fri, 8 Jun 2001, Shawn wrote: > I will start by saying this is largely a learning excersize. I want to > get to the point where I can write a PERL module using some C code in > the backend. I would be greatful as hell for any help on this! You want the Inline::C module! This lets you do some

RE: Pop-up window (Now it's *really* off topic)

2001-06-08 Thread iansmith
On Fri, 8 Jun 2001, Ryan Ware wrote: > Not only off topic, but pop ups suck Well, when used for advertisements they certianly do. There are cases where they are usefull. In an online Baseball game I am working with, we use pop-up windows for scouting reports because almost every time a player c

Re: Use of uninitialized value in string eq at ./adpanel.pl line37.

2001-06-08 Thread iansmith
On Fri, 8 Jun 2001 [EMAIL PROTECTED] wrote: > why is $action undefined? i use my $action; earlier in the script > and i thought that the statement $action = $formdata{action}; > would take care of assigning a value to $action so that it would > not be undefined. If formdat

Re: Need help interpreting a warning

2001-06-08 Thread iansmith
On Thu, 7 Jun 2001, Peter Cline wrote: > Thank you! You hit the nail on the head. Changing the offending line so > that it is wrapped as such: > > if ($input =~ /$$varValueSep/) { > ($var, $value) = split(/$$varValueSep/, $input); >} > > eliminates the warnings. You also hav

Re: directory listing to array

2001-06-07 Thread iansmith
On 7 Jun 2001, Randal L. Schwartz wrote: > Was this on 5.6 or 5.6.1, where the glob is internalized, or on 5.5 or > earlier, where glob called an external process? This is on a RedHat Linux 7.1 os with 5.6.0. -- Ian

Re: directory listing to array

2001-06-07 Thread iansmith
On Fri, 8 Jun 2001, Richard Hulse wrote: > Since someone raised the general question of differences, which is faster? > my @result = <*.jpg>; > or variations on: > @files = grep /jpg/i, readdir DIR; use Benchmark; timethese(1, { 'Glob' => sub { my @result = <*.jpg>; }, 'Read' => sub { opendir

RE: directory listing to array

2001-06-07 Thread iansmith
On Thu, 7 Jun 2001, Peter Cornelius wrote: > use Benchmark; > opendir (DH, ".") or die; > timethese(5, { > 'Randals' => q{my @result = <*.jpg>}, > 'variations' => q{my @result = grep /\.jpg$/i, readdir DH} > }); > closedir(DH) This only reads the directory in once for the 'variati

Re: Getting results from MySQL

2001-06-07 Thread iansmith
On Thu, 7 Jun 2001, Pete Emerson wrote: > 1. $prep_query="SELECT school_name,path from student_data where >student_id=$student_id"; > 2. $query=$dbh->prepare($prep_query); > 3. $query->execute; > 4. $temp=$query->fetchall_arrayref(); > 5. foreach my $row (@$temp) { > 6. ($school,$path)=@$row; >

Re: passing hashes between subroutines

2001-06-04 Thread iansmith
On Sun, 3 Jun 2001, Nic LAWRENCE wrote: > Is it possible to pass hashes between subroutines? When I try stuff like > &foo(%bar); or return %bar; it doesn't seem to work how I would expect. > :-/ You need to pass by reference. Read perlref for details, but try this. Use "&foo(\%bar)" or "return

Re: using fork

2001-06-04 Thread iansmith
On Mon, 4 Jun 2001, Ulises Vega wrote: > I'm using fork with a simple application, and it looks like if the > father process continues executing without waiting his child, the > following is the code that i use: Seems like you want to use the system command instead. system PROGRAM LIST