Re: double quotes around a variable

2001-06-07 Thread Randal L. Schwartz
> "M" == M W Koskamp <[EMAIL PROTECTED]> writes: M> I dont agree with that. M> Using quotes in print statements is a good habit. It makes code M> more readble, since it is clear that the intention is to print a M> scalar value as a string. M> Without quotes the scalar value could also be a

Re: directory listing to array

2001-06-07 Thread Richard Hulse
Since someone raised the general question of differences, which is faster? Randal's suggestion: my @result = <*.jpg>; or variations on: @files = grep /jpg/i, readdir DIR; regards, Richard

LWP

2001-06-07 Thread Stout, Joel R
Hiya, I just started running some CGI scripts. Very cool. But I'm running into a problem both with an example in the CookBook and with a script given to me. Both use LWP so I'm thinking that I'm missing a module or something. I have the basic Active State install loaded on a WinNT book. I see

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 Peter Cornelius
> I got > > Benchmark: timing 5 iterations of Randals, variations... >Randals: 79 wallclock secs (28.94 usr + 49.99 sys = 78.93 > CPU) @ 633.46/s > (n=5) > variations: 0 wallclock secs ( 0.03 usr + 0.00 sys = 0.03 CPU) @ > 166.67/s (n=5) > (warning: too few it

Re: directory listing to array

2001-06-07 Thread Randal L. Schwartz
> "iansmith" == iansmith <[EMAIL PROTECTED]> writes: 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; iansmith> use Benchmark;

RE: directory listing to array

2001-06-07 Thread Peter Cornelius
> which is faster? > > Randal's suggestion: > > my @result = <*.jpg>; > > or variations on: > > @files = grep /jpg/i, readdir DIR; > Try this... use Benchmark; opendir (DH, ".") or die; timethese(5, { 'Randals' => q{my @result = <*.jpg>}, 'variations' => q{my @result =

Re: code to force a fresh page

2001-06-07 Thread Luinrandir Hernson
never mind i found it in javascript Lou - Original Message - From: Luinrandir Hernson To: [EMAIL PROTECTED] Sent: Thursday, June 07, 2001 10:01 PM Subject: code to force a fresh page Im not sure if i need to use java or perl... Heres the scratch. I want to force my w

referer.pl I wrote and works!!!

2001-06-07 Thread Luinrandir Hernson
I am a firm believer in sharing information. here is a working program i just wrote and tested. it my not be clenched-buttock tight code. but, blast it, it works!!! Lou #!/usr/bin/perl -w use strict; use diagnostics; print "Content-type: text/html\n\n"; ## ##declared variables

Re: IS there a module / method for ?

2001-06-07 Thread victor
you can try rsync "Vinay T.S." wrote: > I wanted to know if there is any module or method in an existing module > for > > a) transfer a directory tree from one machine to another > > I could use > > tar xvf - | rsh target_machine " cd ; tar > cvf - ) > > wanted to do this , using an existing m

delay array element

2001-06-07 Thread charles
i've read over push/pop/shift/unshift. is there another function which allows you to delete an array element without leaving it as an empty element? thanks -charles

Re: FW: space

2001-06-07 Thread Karen Cravens
On 7 Jun 2001, at 19:49, Mark S wrote: > Please reply to the list for the benefit of others. Is there a standard rant about lists that don't use a reply-to, or do I have to write my own? (Also insert standard rant here about RFC2822 not properly addressing (no pun intended) the issue. Bah.)

Re: delay array element

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, [EMAIL PROTECTED] said: >i've read over push/pop/shift/unshift. is there another function which >allows you to delete an array element without leaving it as an empty >element? perldoc -f splice -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ I am Maril

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

Pop-up window

2001-06-07 Thread Philip Peeters
Hi, Any pointers on how to best create a pop-up window with some selection (radiobuttons) in it and then get the result back and deal with them. Im familiar with javascript's window.open and the POST-ing of a form, but I don't know how to get my form in the newly opened window (basically how to

code to force a fresh page

2001-06-07 Thread Luinrandir Hernson
Im not sure if i need to use java or perl... Heres the scratch. I want to force my webpage to a new frame/browser so I don't get my site trapped inside someone elses. Lou

RE: directory listing to array

2001-06-07 Thread Peter Cornelius
Looking at the other posting to this I realize I should have included the open and close in the test block. That makes the results... Benchmark: timing 1 iterations of Randals, variations... Randals: 16 wallclock secs ( 6.00 usr + 10.05 sys = 16.05 CPU) @ 622.98/s (n=1) variations: 3 w

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

Komodo!

2001-06-07 Thread neeraj arora
hello, can anybody who uses ASPAN komodo tell me how to use with it when i use the run is stopped there and i cannot input anything anywhere.. neeraj _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com

regd Pl/Sql blocks in DBI

2001-06-07 Thread Prabaharan Dorairajan
Hi, I am unable to pass values from perl to Oracle using DBI. Could any one help me? Here is the program: #!/depot/perl/rel/bin/perl use DBI; my (dbh,sth); $dbh = DBI->connect("orcl", "scott", "tiger","oracle"); my $AddrlineSql = (q{ DECLARE

Re: $ENV

2001-06-07 Thread Philip Peeters
Hi Luinrandir, I had the same problem a while ago. I don't know where I finally got the information, but I now tend to use a little script that shows me all available %ENV :)) #!/usr/bin/perl use CGI # set flush right away after every write or print $|=1; # Get a list

Re: Gurus Wanted!!

2001-06-07 Thread John Joseph Trammell
On Thu, Jun 07, 2001 at 11:50:01PM +, scott lutz wrote: > I have a this fancy bit of recursive search and replace code that I picked > up somewhere, but I would greatly appreciate it if one of the gurus could > explain it in English for me: > > find . -type f -print0 | xargs -0 perl -pi -e

Re: $ENV

2001-06-07 Thread Kevin Meltzer
perldoc perlvar Basically, it holds information about yout current environment. perl -wle 'print qq{$_ => $ENV{$_}\n} for keys %ENV'; Cheers, Kevin On Thu, Jun 07, 2001 at 07:51:50PM -0400, Luinrandir Hernson ([EMAIL PROTECTED]) spew-ed forth: > I have tried > perldoc -f env > perldoc -f htt

Re: using perl in mandrake

2001-06-07 Thread Me
> I'm new to perl too, but I think I can help. Sometimes a dangerous thought... ;> > As far as I can tell, perlscript is embeded > right into an HTML file the same way you > do VBScript or JavaScript If you have a web server set up appropriately to allow this, this is true. There are multiple

Re: $ENV

2001-06-07 Thread John Joseph Trammell
On Thu, Jun 07, 2001 at 07:51:50PM -0400, Luinrandir Hernson wrote: > I have tried > perldoc -f env > perldoc -f http > perldoc -f %env > perldoc -f $env > > to find documentation on %ENV. no luck > anyone??? perldoc perlvar -f is for builtin functions -- Just Another Perl Hacker.

external hash tables

2001-06-07 Thread Peter_Farrar
Hi, I've been looking all over for examples of external hash tables. I know I was reading about them just last week, but now I can't remember where. I belive the commands (functions?) are openhash() and closehash(), or something like that. Pointers, examples, would be a great help. Thanks, P

Gurus Wanted!!

2001-06-07 Thread scott lutz
I have a this fancy bit of recursive search and replace code that I picked up somewhere, but I would greatly appreciate it if one of the gurus could explain it in English for me: find . -type f -print0 | xargs -0 perl -pi -e 's/<>/<>/g' Scott Lutz ___

$ENV

2001-06-07 Thread Luinrandir Hernson
I have tried perldoc -f env perldoc -f http perldoc -f %env perldoc -f $env to find documentation on %ENV. no luck anyone???

FW: space

2001-06-07 Thread Mark S
Please reply to the list for the benefit of others. You should check out apache.org. Chances are you have apache on your mandrake machine already, if you selected it during the install. If not, then it's not difficult to pick up. Another option for you is to make perl scripts, and just run the

Re: perl compiler and editor for windows

2001-06-07 Thread Gabriel Presas
http://www.gnu.org/software/emacs/ emacs works well in linux/windows... free and easy to use - Original Message - From: "Chris Sauer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, June 06, 2001 11:25 PM Subject: perl compiler and editor for windows Help me I have been des

IS there a module / method for ?

2001-06-07 Thread Vinay T.S.
I wanted to know if there is any module or method in an existing module for a) transfer a directory tree from one machine to another I could use tar xvf - | rsh target_machine " cd ; tar cvf - ) wanted to do this , using an existing method instead . Thanks Vinay

Re: Perl & the web

2001-06-07 Thread Gabriel Presas
check out www.masonhq.com mason mixes perl and html very nicely. G - Original Message - From: "Fco. Javier Valladolid Hdez." <[EMAIL PROTECTED]> To: "Sally" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 07, 2001 2:13 AM Subject: RE: Perl & the web

Re: double quotes around a variable

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Karen Cravens said: >On 7 Jun 2001, at 15:16, Jeff 'japhy' Pinyan wrote: > >> They enforce stringification. This can be a problem when printing arrays, >> or sending references to functions: > >'Course, they can be a bennie when printing arrays (of words, >usually), too: > >print @arr

RE: space

2001-06-07 Thread Chas Owens
On 07 Jun 2001 19:36:57 -0400, Mark S wrote: > You could just set up a web server on your own machine, if that's all you're > looking to do. > > > -Original Message- > From: bc [mailto:[EMAIL PROTECTED]] > Sent: Thursday, June 07, 2001 7:34 PM > To: [EMAIL PROTECTED] > Subject: space >

Re: double quotes around a variable

2001-06-07 Thread Brett W. McCoy
On Thu, 7 Jun 2001, Jeff 'japhy' Pinyan wrote: > Well, of course it can be useful. That's why it's there. ;) > > But the problem is that people don't know WHAT stringification is. They > are never told that "@foo" is really join($", @foo), and so they just > assume Perl is going to do what they

Re: using perl in mandrake

2001-06-07 Thread Me
This is covered on page 2 of the first edition; I find it hard to believe it isn't also covered right at the beginning of the second edition. As it says in the first, start by typing the following at a shell prompt: perl If you get "not found", then you don't have perl installed (at least n

Re: problem saving binary data

2001-06-07 Thread Peter Scott
At 11:35 AM 6/5/01 -0500, you wrote: >(sorry 'bout the duplicate - bad data) > >I'm using LWP to fetch an image and attempting to save it locally. >The file is successfully created, however all it contains is: > >HTTP::Response=HASH(0x8380464) > > >Here's the code snippet: > > $file = "/home/imag

RE: space

2001-06-07 Thread Mark S
You could just set up a web server on your own machine, if that's all you're looking to do. -Original Message- From: bc [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07, 2001 7:34 PM To: [EMAIL PROTECTED] Subject: space who knows of some free web space that allows the use of perl? s

Pel.org

2001-06-07 Thread Page Works
I have gone through the unsubscribe page and rec. the unsubscribe notice from perl.org, how do I stop, or get off this mail list. I am still getting about 30 to 40 emails an hour from all of you.. Shawn -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of

Re: double quotes around a variable

2001-06-07 Thread Karen Cravens
On 7 Jun 2001, at 17:10, Jeff 'japhy' Pinyan wrote: > But the problem is that people don't know WHAT stringification is. They > are never told that "@foo" is really join($", @foo), and so they just > assume Perl is going to do what they mean, when Perl is really doing what > is documented. Well

Re: [OT] fetchrow_hashref vs. fetchrow_arrayref

2001-06-07 Thread Chas Owens
On 07 Jun 2001 14:53:40 -0800, Michael Fowler wrote: > On Thu, Jun 07, 2001 at 05:27:16PM -0400, Chas Owens wrote: > > In DBI, it (fetchrow_hashref, not fetchhash) returns a hash where the > > keys = column names and values = value of the columns on the row. I > > consider it a generaly bad thing

space

2001-06-07 Thread bc
who knows of some free web space that allows the use of perl? so i can test my "hello world" program and more and more... :) bc

Re: INSERTing problems

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 05:34:08PM -0400, Chas Owens wrote: > What is the airspeed of an unladen swallow? What -kind- of swallow? :) Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com --

RE: double quotes around a variable

2001-06-07 Thread Travis Smith
Either you or I (or maybe both us) have a really dirty mind. Isn't that like: (true != 0) You know, there's no and/or operator. In ksh you do have the |& - but that's something different. Completely useless, but I want a and/or operator. ~Travis Smith Systems Admin finger sage at post891 d

Re: double quotes around a variable

2001-06-07 Thread Brett W. McCoy
On Thu, 7 Jun 2001, M.W. Koskamp wrote: > > They're bad mainly because they suggest that the author doesn't understand > > Perl well. So if I see code like that, my spidey sense starts tingling > and > > I wonder how good the code is. Why would someone type unnecessary quotes > > unless they we

Re: double quotes around a variable

2001-06-07 Thread Chas Owens
> > Ah, another Perl Couple. Congratulations. Right now I am delivering > specifications to my wife for implementation :-) Either you or I (or maybe both us) have a really dirty mind. -- Today is Pungenday, the 12nd day of Confusion in the YOLD 3167 Grudnuk demand sustenance!

Re: INSERTing problems

2001-06-07 Thread Chas Owens
What database server are you using? What error messages are you getting? What do your DBI calls look like? What is the airspeed of an unladen swallow? On 07 Jun 2001 15:42:09 -0500, SAWMaster wrote: > That makes complete sense in two ways, first the way you suggested it, > second, if I were t

[OT] fetchrow_hashref vs. fetchrow_arrayref

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 05:27:16PM -0400, Chas Owens wrote: > In DBI, it (fetchrow_hashref, not fetchhash) returns a hash where the > keys = column names and values = value of the columns on the row. I > consider it a generaly bad thing since it forces you to alias your > columns when you have tw

Re: INSERTing problems

2001-06-07 Thread SAWMaster
That makes complete sense in two ways, first the way you suggested it, second, if I were to ever try to insert a record that was actually NULL for instance if I didn't have a newCat to enter for one record...your suggestion would handle that too... Thanks for that. But my main problem remains.

[OT] and/or operator

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 06:39:32PM -0400, Travis Smith wrote: > > Either you or I (or maybe both us) have a really dirty mind. > > > Isn't that like: > (true != 0) Nope, that's ($you || $I || ($you && $I)), which reduces to simply ($you || $I). > You know, there's no and/or operator. In k

Re: external hash tables

2001-06-07 Thread John Joseph Trammell
On Thu, Jun 07, 2001 at 05:45:23PM -0400, [EMAIL PROTECTED] wrote: > > I've been looking all over for examples of external hash tables. I know I was > reading about them just last week, but now I can't remember where. I belive the > commands (functions?) are openhash() and closehash(), or some

Re: double quotes around a variable

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Peter Scott said: >At 05:03 PM 6/7/01 -0500, Karen Cravens wrote: >>I always figured print "@foo" was going to print >>the array reference, and never used it, until one day I was >>"correcting" my husband while reading over his shoulder after he'd >>asked for help debugging, and he told

Re: double quotes around a variable

2001-06-07 Thread Karen Cravens
On 7 Jun 2001, at 15:16, Jeff 'japhy' Pinyan wrote: > They enforce stringification. This can be a problem when printing arrays, > or sending references to functions: 'Course, they can be a bennie when printing arrays (of words, usually), too: print @array; # why's it all smooshed together? p

Re: fetchhash question

2001-06-07 Thread Chas Owens
In DBI, it (fetchrow_hashref, not fetchhash) returns a hash where the keys = column names and values = value of the columns on the row. I consider it a generaly bad thing since it forces you to alias your columns when you have two (or more) columns with the same name or an expersion as a column i

Re: one last problem...

2001-06-07 Thread daniels tashi robert
It looks like there is a single space between each data value; if so, you can split on whitespace rather than all the nasty pattern matching; did this not work for you? On Thu, 7 Jun 2001, Brent Buckalew wrote: > Hello all, > > I tried putting the following into the program but it doesn't rea

problem saving binary data

2001-06-07 Thread Jeff Davis
(sorry 'bout the duplicate - bad data) I'm using LWP to fetch an image and attempting to save it locally. The file is successfully created, however all it contains is: HTTP::Response=HASH(0x8380464) Here's the code snippet: $file = "/home/images/$name"; open(IMAGE, ">$file") || die "unabl

Re: double quotes around a variable

2001-06-07 Thread Peter Scott
At 05:03 PM 6/7/01 -0500, Karen Cravens wrote: >I always figured print "@foo" was going to print >the array reference, and never used it, until one day I was >"correcting" my husband while reading over his shoulder after he'd >asked for help debugging, and he told me what a doofus I was. >(Well, h

[OT]RE: double quotes around a variable

2001-06-07 Thread Chas Owens
Actually you already have an and/or operator (or). The English equivilent for "or" in perl is "xor". Examine: Take this or that (NB this implies you cannot take both, but you must take one). take table (instead of truth table) left left = not allowed (false) left took = allowed (true) took left

Re: INSERTing problems

2001-06-07 Thread Chas Owens
Opps, missed the insert statment at the bottom. Change "What do your DBI calls look like" to "What does your data look like?" On 07 Jun 2001 17:34:08 -0400, Chas Owens wrote: > What database server are you using? > What error messages are you getting? > What do your DBI calls look like? > Wh

Re: fetchhash question

2001-06-07 Thread John Joseph Trammell
On Thu, Jun 07, 2001 at 04:34:48PM -0400, Bradshaw, Brian wrote: > You guys have been so nice.. I have another question :) > > What does fetchhash do? > > I have the code : > $return_hash = $dbh->query($query) or print "$query\n\n"; > %result = $return_hash->fetchhash(); > But I am u

fetchhash question

2001-06-07 Thread Bradshaw, Brian
You guys have been so nice.. I have another question :) What does fetchhash do? I have the code : $return_hash = $dbh->query($query) or print "$query\n\n"; %result = $return_hash->fetchhash(); But I am unsore of what the fetchhash does. Thanks again! Brian Bradshaw Systems Engi

Re: using perl in mandrake

2001-06-07 Thread SAWMaster
I'm new to perl too, but I think I can help. As far as I can tell, perlscript is embeded right into an HTML file the same way you do VBScript or JavaScript, so your file would have the regular *.html extention. If on the other hand, you are using a full fledged perl program, you can run it from

Re: double quotes around a variable

2001-06-07 Thread Peter Scott
At 10:22 PM 6/7/01 +0200, M.W. Koskamp wrote: >- Original Message - >From: Peter Scott <[EMAIL PROTECTED]> >To: Byron Rendar <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> >Sent: Thursday, June 07, 2001 9:11 PM >Subject: Re: double quotes around a variable > > > > At 09:50 AM 6/7/01 -0700, Byro

Re: double quotes around a variable

2001-06-07 Thread M.W. Koskamp
- Original Message - From: Peter Scott <[EMAIL PROTECTED]> To: Byron Rendar <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, June 07, 2001 9:11 PM Subject: Re: double quotes around a variable > At 09:50 AM 6/7/01 -0700, Byron Rendar wrote: > >my $input= ; > > my $username =

Re: one last problem...

2001-06-07 Thread Brent Buckalew
Hello all, I tried putting the following into the program but it doesn't read out the necessary data just yet. I'm not sure why not. I've had to modify it to the following so that it'll run and not complain to me. Here's what it looks like now. do { $discard_line = ; } until ($discard_line

using perl in mandrake

2001-06-07 Thread bc
i have mandrake8 and use kde, i normally use asp/vbScript and want to make the move to perl. I just got "learning perl" 2nd Ed. it does not seem to tell me what to do w/ my script i type, where to save it, what to save it as (extention), and do i just ftp it to my domain that is on a perl

Re: double quotes around a variable

2001-06-07 Thread Peter Scott
At 03:53 PM 6/7/01 -0400, Pete Emerson wrote: >Respectfully, I disagree with this: > >Peter Scott wrote: > > > They're bad mainly because they suggest that the author doesn't understand > > Perl well. So if I see code like that, my spidey sense starts tingling and > > I wonder how good the code i

Re: avoiding duplicate values

2001-06-07 Thread David Gilden
> On Jun 7, David Gilden said: > > >@colors = qw[ #F0F8FF #00 #7FFFD4 #F0 #F5F5DC #FFE4C4 #4169E1 > >#8B4513 #FA8072 #F4A460 #2E8B57 #A0522D ]; > > > > > ># choose a color! > >$color_choice1 = rand $#colors; On Thursday, June 7, 2001 at 3:40 PM, [EMAIL PROTECTED] (Jeff 'japhy' Pinyan) w

Re: double quotes around a variable

2001-06-07 Thread Pete Emerson
Respectfully, I disagree with this: Peter Scott wrote: > They're bad mainly because they suggest that the author doesn't understand > Perl well. So if I see code like that, my spidey sense starts tingling and > I wonder how good the code is. Why would someone type unnecessary quotes > unless t

Re: avoiding duplicate values

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, David Gilden said: >@colors = qw[ #F0F8FF #00 #7FFFD4 #F0 #F5F5DC #FFE4C4 #4169E1 >#8B4513 #FA8072 #F4A460 #2E8B57 #A0522D ]; > > ># choose a color! >$color_choice1 = rand $#colors; You're never going to select "#A0522D" this way -- you need to use rand(@colors), not rand($#col

avoiding duplicate values

2001-06-07 Thread David Gilden
Is this the correct way to avoid getting the same value twice? # Text colors @colors = qw[ #F0F8FF #00 #7FFFD4 #F0 #F5F5DC #FFE4C4 #4169E1 #8B4513 #FA8072 #F4A460 #2E8B57 #A0522D ]; # choose a color! $color_choice1 = rand $#colors; # make sure we don't get same color twice $color_c

Re: More "Succinctification"

2001-06-07 Thread Paul
--- Teresa Raymond <[EMAIL PROTECTED]> wrote: > How can we make this code more succinct? A quick run through perltidy adds some whitespace: #LOOP TO INITIALIZE VARIABLES + TEST N COMMANDS FOR MATCH IS YES foreach $i( sort(@indata) ) { chop

Re: Variable scope behavior in foreach loop

2001-06-07 Thread Peter Scott
At 01:08 PM 6/7/01 -0400, Robin Lavallee (LMC) wrote: > I have a small conceptual problem. I have been >told that doing: > >my $item; >foreach $item (@arr) { ... } > >is more efficient than: >foreach my $item (@arr) { ... } Even if it is, this is the wrong thing to optimize for. If you'r

Re: multilingual capabilities of perl

2001-06-07 Thread rob chanter
On Wed, Jun 06, 2001 at 07:23:59PM +0530, Saritha_Vinod wrote: > Hi > > Can we use perl to show multiple languages on the browser? > Sure. Perl may not be the cleanest way to do it, but you could. Use CGI.pm, and look for an "Accept-Language" header coming from the user agent. You could then f

Re: double quotes around a variable

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Byron Rendar said: >my $input= ; > my $username = chop( $input ); >print "$username"; > >Why are double quotes around $username a "bad" thing in the print statement? They enforce stringification. This can be a problem when printing arrays, or sending references to functions: @

this email is comming to me by mistake, Please stop sending.

2001-06-07 Thread Page Works
To subscribers at Perl.org I have received at least 150 emails today, these letters that you all are sending to Perl.org are landing in my email box, and not to perl.org... Sincerly, Over it! -Original Message- From: Teresa Raymond [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 07,

Re: double quotes around a variable

2001-06-07 Thread Brett W. McCoy
On Thu, 7 Jun 2001, Byron Rendar wrote: > my $input= ; > my $username = chop( $input ); > print "$username"; > > Why are double quotes around $username a "bad" thing in the print statement? Who said they are? In your example the double quotes aren't necessary, but they are required if you

Re: double quotes around a variable

2001-06-07 Thread Peter Scott
At 09:50 AM 6/7/01 -0700, Byron Rendar wrote: >my $input= ; > my $username = chop( $input ); >print "$username"; > >Why are double quotes around $username a "bad" thing in the print statement? They're bad mainly because they suggest that the author doesn't understand Perl well. So if I see

RE: double quotes around a variable

2001-06-07 Thread Peter Cornelius
> print "$username"; > > Why are double quotes around $username a "bad" thing in the > print statement? They are? I do print "your username is $username\n"; all the time. I know that doesn't mean it's right but I've never had a problem with it. If all you're printing in print "$username"; th

Re: More "Succinctification"

2001-06-07 Thread Karen Cravens
On 7 Jun 2001, at 13:51, Teresa Raymond wrote: > How can we make this code more succinct? In addition to what some other posters have said, there are ways to make comparisons more cleanly, if you don't have to rely on the human-readable (more specifically, *end user*-readable) version of the

Re: directory listing to array

2001-06-07 Thread Peter Scott
At 01:45 PM 6/7/01 -0500, Shawn wrote: >Can someone let me know what effectively is the difference between >@files = grep {/jpe?g$/i} readdir DIR; >and >@files = grep /jpe?g$/i, readdir DIR; >? > >Or is there any? There isn't. Some people like to use only the block form even in those cases wher

double quotes around a variable

2001-06-07 Thread Byron Rendar
my $input= ; my $username = chop( $input ); print "$username"; Why are double quotes around $username a "bad" thing in the print statement? Byron Rendar [EMAIL PROTECTED] (503) 533-2792(w) (503) 533-2999(fax) Portland Community College

Re: regexp question

2001-06-07 Thread Martin Weinless
Hi, New messages are coming in as I write. Thanks to all. My error was in assuming that because '.' is a metacharacter, the match must start with the initial 's'. However as was pointes out (and in retrospect, it makes perfect sense, the regexp engine is looking for any single character before t

Re: regexp question

2001-06-07 Thread Peter Scott
At 10:10 AM 6/7/01 -0700, Paul wrote: > . matches the r in supernova > n+ matches one or more n's, so it matches the n in supernova > . matches the o in supervova > .? matches one or no characters, so it matches nothing > (successfully, twice) > v* matches any number of v's, includ

Re: More "Succinctification"

2001-06-07 Thread Shawn
ITakeItTheyDidNotWantToUseWhitespace? On 06/07, Teresa Raymond rearranged the electrons to read: > How can we make this code more succinct? > > #LOOP TO INITIALIZE VARIABLES + TEST N COMMANDS FOR MATCH IS YES > foreach $i (sort(@indata)) > {chop($i); > ($aptname,$address,$city,$zip,$phone,$locat

Re: More "Succinctification"

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Teresa Raymond said: >How can we make this code more succinct? I'll answer a different question: "How can we make this code more readable, so that people will bother to look twice at it?" Don'twritePerlasifthere'snotimeleftinyourdaytodoitwell. Youshouldtry tohaveanice indentations

Re: directory listing to array

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Shawn said: >Japhy pointed out this particular syntax to me. Before this, I was using >@files = grep {/jpe?g$/i} readdir DIR; > >Can someone let me know what effectively is the difference between >@files = grep {/jpe?g$/i} readdir DIR; >and >@files = grep /jpe?g$/i, readdir DIR; If you

Re: More "Succinctification"

2001-06-07 Thread Brett W. McCoy
On Thu, 7 Jun 2001, Teresa Raymond wrote: > How can we make this code more succinct? Use CGI.pm and get rid of all of that HTML and backslashes. If you must use quoted strings, use qq() to quote your strings to you don't have to backslashs stuff. That must be real fun to debug. :-) -- Brett

Re: regex question

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Pete Emerson said: >I don't know about anybody else, but I would LOVE a blow by blow >interpretation of this (by anyone). I assume q{} and qr{} are pattern >matching, although my reference here (Nutshell) comments only briefly on q, >not qr, is that a typo? It looks like you're setting

Re: directory listing to array

2001-06-07 Thread Shawn
Japhy pointed out this particular syntax to me. Before this, I was using @files = grep {/jpe?g$/i} readdir DIR; Can someone let me know what effectively is the difference between @files = grep {/jpe?g$/i} readdir DIR; and @files = grep /jpe?g$/i, readdir DIR; ? Or is there any? On 06/07, Pete E

More "Succinctification"

2001-06-07 Thread Teresa Raymond
How can we make this code more succinct? #LOOP TO INITIALIZE VARIABLES + TEST N COMMANDS FOR MATCH IS YES foreach $i (sort(@indata)) {chop($i); ($aptname,$address,$city,$zip,$phone,$location,$bedrooms,$rentmin,$ren tmax,$pets,$laundry,$garage,$comment,$aptweb,$aptemail,$graphic)=split (/\|/,$i)

Re: Problem with getting a file to open

2001-06-07 Thread rob chanter
On Thu, Jun 07, 2001 at 12:39:33PM -0400, Andrew Nelson wrote: > You can open a file via open() for reading or writing, but not both. Try > > open (FILE, $file); > print FILE; > close(FILE); > > And see if that doesnt help. > Not quite true. To read and write, try open (FILE, "+<$file"); N

Re: regex question

2001-06-07 Thread Pete Emerson
I don't know about anybody else, but I would LOVE a blow by blow interpretation of this (by anyone). I assume q{} and qr{} are pattern matching, although my reference here (Nutshell) comments only briefly on q, not qr, is that a typo? It looks like you're setting up a regular expression ahead of t

Re: regex question

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 11:02:54AM -0700, Adrian Pang wrote: > I'm trying to write a regex expression so it will extract the attribute > names from a tag. For example, > > The regex should return attr1, attr2, attr3 and attr4 > Is there anyway to write these into one regex expression? Don't try

Re: regex question

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Adrian Pang said: >I'm trying to write a regex expression so it will extract the attribute >names from a tag. For example, > > > >The regex should return attr1, attr2, attr3 and attr4 >Is there anyway to write these into one regex expression? You should really be using a real HTML par

Re: directory listing to array

2001-06-07 Thread Pete Emerson
...and just to include both .jpg and .jpeg like John's program: opendir DIR, "./" or die "can't open $directory: $!\n"; @files = grep /jpe?g$/i, readdir DIR; Nice code, Shawn. I must admit that my original way of doing this was even worse than John's (by not using opendir and closedir). Zoiks. G

regex question

2001-06-07 Thread Adrian Pang
Hi: I'm trying to write a regex expression so it will extract the attribute names from a tag. For example, The regex should return attr1, attr2, attr3 and attr4 Is there anyway to write these into one regex expression? Thanks, Adrian

Re: directory listing to array

2001-06-07 Thread Shawn
Holy JESUS! Why not: opendir DIR, $directory or die "can't open $directory: $!\n"; @files = grep /jpg$/i, readdir DIR; On 06/07, John Storms rearranged the electrons to read: > my($path) = "/home/jstorms/public_html/images/"; > my(@files) = get_jpg_from_dir($path); > > sub get_jpg_from_dir { >

Weekly list FAQ posting

2001-06-07 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address)

Re: Variable scope behavior in foreach loop

2001-06-07 Thread Jeff 'japhy' Pinyan
On Jun 7, Paul said: >--- "Robin Lavallee (LMC)" <[EMAIL PROTECTED]> wrote: >> Then can someone explains why the following code: >> >> #---Begin Code--- >> use strict; >> my $par="50"; >> print "$par\n"; >> >> my @arr = ('first', 'second', 'third'); >> foreach $par (@arr) >> { >> print "$p

  1   2   >