[13245] in Perl-Users-Digest
Perl-Users Digest, Issue: 655 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 26 15:07:24 1999
Date: Thu, 26 Aug 1999 12:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Thu, 26 Aug 1999 Volume: 9 Number: 655
Today's topics:
Re: <ilayer> and cgi stumper <jalovel@spamblock.enteract.com>
Re: Accounts and CPAN module <bkline@rksystems.com>
Re: CGI scan multiple web pages for info? <leenick@interchange.ubc.ca>
Re: compiler for Perl? <flavell@mail.cern.ch>
Re: compiler for Perl? (Greg Bacon)
Re: cool programming site <cassell@mail.cor.epa.gov>
Creating stand alone apps out of perl script <stevel@image.com>
Re: Help! Syntax error that I can't find! <rlester@columbus.rr.com>
Re: How to Detect that a Process is running already <markm@nortelnetworks.com>
Re: Images (Eric Bohlman)
Re: Implementing a Perl Script on NT <tbornhol@prioritytech.com>
Re: Locate a substring?! <laurensmith@sprynet.com>
Re: Locate a substring?! (Abigail)
Re: Locate a substring?! (Andrew Johnson)
Re: loop through a hash of arrays based on array elemen (Larry Rosler)
Re: loop through a hash of arrays based on array elemen (Larry Rosler)
Open Source Perl Shell Available <ralphcf@home.com>
Re: Pattern Matching <anmolnar@videon.wave.ca>
Re: Pattern Matching (Larry Rosler)
Re: print dollar format? (Larry Rosler)
Re: Regex Question <samay1NOrmSPAM@hotmail.com>
Re: Sorting by third field in a random access database (Larry Rosler)
Re: The extent of double-quotish interpolation (Abigail)
Timeing out "new Net::FTP" (Donovan Rebbechi)
Re: want to start a cgi-programm when someone visits my (Abigail)
Re: where command is coming from (Abigail)
Re: where command is coming from <phil@proteacher.com>
Re: where command is coming from (Greg Bacon)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Aug 1999 18:32:11 GMT
From: Jeff Lovell <jalovel@spamblock.enteract.com>
Subject: Re: <ilayer> and cgi stumper
Message-Id: <7q417b$2g4j$1@news.enteract.com>
noah <noahNOraSPAM@salemglobal.com> wrote:
> Does anyone have any experience using Netscape's <ILAYER>
> tag? I tried using
> it in a CGI form as an SSI work-around, which seemed to
> work fine, except
> that a CGI global expression that I used later in the page
> now doesn't
> appear. Any suggestions?
Yes, try the right newsgroup.
------------------------------
Date: 26 Aug 1999 14:44:30 GMT
From: Bob Kline <bkline@rksystems.com>
Subject: Re: Accounts and CPAN module
Message-Id: <7q3jse$39g$1@news.servint.com>
Abigail <abigail@delanet.com> wrote:
: That of course assumes your Perl installation is owned by root.
: But there's no reason it should be owned by root. And since everyone
: can put a package in CPAN, I'm don't like blindy running 'make' or
: 'make install' as root.
OK, I've never been comfortable that default installations of perl
are owned by root. So is it reasonable to create a dummy user and
just do a chown -R perl:perl /usr/lib/perl5? Any gotchas or other
little details to attend to?
--
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com
------------------------------
Date: Thu, 26 Aug 1999 11:22:01 -0700
From: Nick Lee <leenick@interchange.ubc.ca>
To: Tim Wilson <fred@hotmail.com>
Subject: Re: CGI scan multiple web pages for info?
Message-Id: <37C585C9.36BEB11C@interchange.ubc.ca>
Go to www.wdvl.com
They have a great tutorial teaching you how to do that using LWP.
----------------------------------
Tim Wilson wrote:
>
> Hi,
>
> I want a script or any method to automatically view a url, search and
> extract some data from
> a page and write it out to a file. I have a text file with about 50 URL's in
> it, and I want to avoid
> the process of manually cutting and pasting each page into Word or similar
> just to get at the data.
>
> Any thoughts as I've looked for hours on the web and cannot find anything!
>
> Thanks in advance,
>
> Mark.
------------------------------
Date: Thu, 26 Aug 1999 19:42:13 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: compiler for Perl?
Message-Id: <Pine.HPP.3.95a.990826194119.11032M-100000@hpplus03.cern.ch>
On Thu, 26 Aug 1999, Phil Schaechter wrote:
> There is no such thing as a perl compiler. Perl is an interpreted language.
Gosh, how confidently you spouted that. Have you ever read an FAQ?
------------------------------
Date: 26 Aug 1999 19:05:01 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: compiler for Perl?
Message-Id: <7q434t$7bg$2@info2.uah.edu>
In article <LXex3.4$UK.255@chrome.eng.netapp.com>,
"Phil Schaechter" <phil@proteacher.com> writes:
: There is no such thing as a perl compiler.
What the fuck are you talking about? Do you know what a compiler is?
Don't dare say "software that takes high level language code and outputs
native machine code". Does an invocation like
% gcc -o /dev/null module.c
make gcc cease to be a C compiler?
: Perl is an interpreted language.
Do you know what an interpreter is? (No, I'm not asking you to spit
back some marketroid drivel. I'm talking about a definition from
computer science.)
Sorry to be so harsh, but it's really irritating when less-than-clueful
people make absurd claims about Perl.
Greg
--
A Freudian slip is when you say one thing when you're thinking about a mother.
-- Cliff Clavin
------------------------------
Date: Thu, 26 Aug 1999 11:11:01 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: cool programming site
Message-Id: <37C58335.10EFC7E4@mail.cor.epa.gov>
IlIIIIIIII wrote:
>
> here is a cool programming web site: http://devlibrary.tsx.org/
Well, he's back again. He's still at virtualave and he
still doesn't know that Perl is anything except CGI. Since
he has even asked for help in this ng in the past, that fact
really annoys me.
And he's got pictures of O'Reilly books which are links to
Amazon. OTOH, the books shown are *good* books, only one
of which has primary relevance to webwork. Draw your own
conclusion. But don't waste your time going to his site.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 26 Aug 1999 11:20:19 -0700
From: Stephen Lamb <stevel@image.com>
Subject: Creating stand alone apps out of perl script
Message-Id: <37C58563.664F8212@image.com>
Does any one know of a Windows equivalent to the following Mac
application
From http://cfcl.com/macperl/depts/Code/
RuntimeBuilder (Michael Ziege) - converts a Perl script into a folder
containing a Perl runtime, along with all of its dynamically
loaded shared
libraries. All imported modules are copied into the resource fork
of the
runtime file. (PowerPC only)
It allows one to turn a perl script into a stand alone app on the Mac.
------------------------------
Date: Thu, 26 Aug 1999 14:06:31 -0400
From: Ron Lester <rlester@columbus.rr.com>
Subject: Re: Help! Syntax error that I can't find!
Message-Id: <37C58227.BA846657@columbus.rr.com>
Thanks, I made those changes but the script still isn't running. When I try to
run it, I get error messages telling me to write my array variables with a
backslash before them (e.g. \@db_row rather than @db_row). Why does it tell me
to do this? I'm pasting the error messages below, in case anyone can decipher
them... I really appreciate this!
Natalie
=======
In string, @db_row now must be written as \@db_row at ProductHelper.pm line
103, near "$i = 0;
my @db_row"
In string, @products_kw_temp now must be written as \@products_kw_temp at
ProductHelper.pm line 103, ne
ar "@db_row;
my @products_kw_temp"
syntax error at ProductHelper.pm line 104, near "my"
syntax error at ProductHelper.pm line 127, near "if (($db_row[4] =~ /$i/i) ||
($db_row[6] =~"
(Might be a runaway multi-line ]] string starting on line 103)
------------------------------
Date: 26 Aug 1999 14:08:54 -0400
From: Mark Mielke <markm@nortelnetworks.com>
Subject: Re: How to Detect that a Process is running already
Message-Id: <lq1672276tl.fsf@bmers31f.ca.nortel.com>
> John Nolt wrote in message <37C48CA0.C05CB617@mindspring.net>...
> >I'm hoping that this is a simple question.
> >I want to create a CGI that runs a perl script. However, if that perl
> >script is already running, I want to pop up a message that says
> >something to the effect of "I'm sorry, the script is already running.
> >Try again later."
> >So, I need to detect if the perl script is running. How do I do that?
> >The camel book chapter on IPC didn't really clue me in as to detecting
> >instances of scripts.
> >I realize that I may be jumping the gun since I haven't done much
> >development on this little application, but I would like to get an idea
> >in my head for this piece of the puzzle if possible.
"Phil Schaechter" <phil@proteacher.com> writes:
> Perhaps you could just do a process list on the machine, and see if thats
> already running?
> Redirect ps -aux to a file, and parse through it looking for your script?
> This isn't the most secure way, but it works.
Or, I'd be tempted to just create a file in the user's home directory,
or in /tmp, such as ~/.program_name/lock, or /tmp/program_name-userid,
and then perform an non-blocking flock() on it. Something like:
use Fcntl qw(:DEFAULT :flock);
...
sysopen(lockfile, "/tmp/program_name-userid", O_RDONLY|O_CREAT) ||
die "$0: creation of lockfile failed: $!\n";
flock(lockfile, LOCK_EX | LOCK_NB) ||
die "$0: I'm sorry, the script is already running. Try again later.\n";
...
# Don't do this until your program is done!!!
flock(lockfile, LOCK_UN);
close(lockfile);
/tmp is probably a better choice, as I believe there are issues when locking
a file over NFS. (Home directories are often mounted)
mark
--
markm@nortelnetworks.com/mark@mielke.cc/markm@ncf.ca __________________________
. . _ ._ . . .__ . . ._. .__ . . . .__ | CUE Development (4Y21)
|\/| |_| |_| |/ |_ |\/| | |_ | |/ |_ | Nortel Networks
| | | | | \ | \ |__ . | | .|. |__ |__ | \ |__ | Ottawa, Ontario, Canada
One ring to rule them all, one ring to find them, one ring to bring them all
and in the darkness bind them...
http://mark.mielke.cc/
------------------------------
Date: 26 Aug 1999 19:00:46 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Images
Message-Id: <7q42su$4an@dfw-ixnews5.ix.netcom.com>
Phil Schaechter (phil@proteacher.com) wrote:
: Or you could make it easy on yourself, and have it print out smaller height
: and width tags, the browser will then resize the picture for you
That's making it easy on yourself and hard on your viewer, who will have
to download *all* the full-size images in order to see the "thumbnails"
(Randal calls them "dumbnails"), which will likely appear severely
distorted (browsers generally do a bad job rescaling).
------------------------------
Date: Thu, 26 Aug 1999 13:55:54 -0500
From: "Tim Bornholtz" <tbornhol@prioritytech.com>
Subject: Re: Implementing a Perl Script on NT
Message-Id: <2820CF459DC7E06E.B3B9C096F42C3E16.4D96CB6568557D23@lp.airnews.net>
Julie Tuck <iwebmaster@email.com> wrote in message
news:7q51h7$mm1$1@news.vsnl.net.in...
> I have made a perl script that works perfectly well on a Unix server,, but
> now I require to Execute it on an NT server, could you please tell what
> chanes should make in the script to make it work on an NT server.
Unless you are making OS dependent calls using system() or `` or if you are
using certain functions for processes, there shouldn't be any changes at
all.
The functions that don't work are clearly defined in the ActivePerl FAQ.
hth,
Tim Bornholtz
tbornhol@prioritytech.com
------------------------------
Date: Thu, 26 Aug 1999 10:51:46 -0700
From: "Lauren Smith" <laurensmith@sprynet.com>
Subject: Re: Locate a substring?!
Message-Id: <7q3url$r8r$1@brokaw.wa.com>
Phil Schaechter wrote in message ...
>Does anyone know how to locate a substring within a string in perl? Is
>there a simple function for this (something like strstr() in C?)
Hold onto your hat on this one... *drumroll*
.
.
.
substr()
*fanfare*
>Thanks for any help
HTH
Lauren
------------------------------
Date: 26 Aug 1999 13:18:37 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Locate a substring?!
Message-Id: <slrn7sb19h.n0r.abigail@alexandra.delanet.com>
Phil Schaechter (phil@proteacher.com) wrote on MMCLXXXVI September
MCMXCIII in <URL:news:JUex3.2$UK.240@chrome.eng.netapp.com>:
@@
@@ Does anyone know how to locate a substring within a string in perl? Is
@@ there a simple function for this (something like strstr() in C?)
Yes.
Abigail
--
And it's in the manual!
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 26 Aug 1999 18:24:41 GMT
From: andrew-johnson@home.com (Andrew Johnson)
Subject: Re: Locate a substring?!
Message-Id: <JDfx3.13713$dr6.232002@news1.rdc2.on.home.com>
In article <7q3url$r8r$1@brokaw.wa.com>,
Lauren Smith <laurensmith@sprynet.com> wrote:
!
! Phil Schaechter wrote in message ...
! >Does anyone know how to locate a substring within a string in perl? Is
! >there a simple function for this (something like strstr() in C?)
!
! Hold onto your hat on this one... *drumroll*
! substr()
!
! *fanfare*
substr() isn't much help in locating substrings ... you'll want
to use index() or rindex() to find the offset of the first or
last occurrence of a substring within a string.
andrew
--
The generation of random numbers is too
important to be left to chance.
------------------------------
Date: Thu, 26 Aug 1999 11:18:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: loop through a hash of arrays based on array element?
Message-Id: <MPG.122f24bdff5394d4989eaf@nntp.hpl.hp.com>
In article <37C47360.4941C2F2@cisco.com> on Wed, 25 Aug 1999 15:51:12 -
0700, Makarand Kulkarni <makkulka@cisco.com> says...
+ [ Alec Kelingos wrote:
+
+ > How can I sort a hash of arrays based on one of the array elements?
+ > For example, I have a hash
+ > %columns = (
+ > 'API' => ['A', 1, 14, 'STR', 1],
+ > 'LATITUDE' => ['A', 2, 9, 'LAT', 2],
+ > 'LONGITUDE' => ['A', 3, 20, 'LON', 3],
+ > 'TD_FORM' => ['A', 4, 8, 'STR', 4],
+ > 'PR_FORM' => ['A', 5, 8, 'STR', 5],
+ > 'STATUS' => ['A', 8, 6, 'STR', 6]
+ > );
+
+ See the code sample below
+
+ %columns = (
+ 'API' => ['A', 1, 14, 'STR', 1],
+ 'LATITUDE' => ['A', 2, 9, 'LAT', 2],
+ 'LONGITUDE' => ['A', 3, 20, 'LON', 3],
+ 'TD_FORM' => ['A', 4, 8, 'STR', 4],
+ 'PR_FORM' => ['A', 5, 8, 'STR', 5],
+ 'STATUS' => ['A', 8, 6, 'STR', 6]
+ );
Thanks for showing the hash again, in case we had forgotten.
+ $columns = \%columns ;
I'm sure that this ref must serve some purpose other than to lengthen
and slow down the code.
...
+ @sorted = sort { $columns->{$a}->[4] cmp $columns->{$b}->[4] } keys
%columns ;
I hope there are always fewer than 10 elements in the hash.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 11:29:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: loop through a hash of arrays based on array element?
Message-Id: <MPG.122f2774289c3f24989eb1@nntp.hpl.hp.com>
In article <37C57174.D3C8C37E@earthlink.net> on Thu, 26 Aug 1999
09:55:16 -0700, Joe Schmoe <dont_ever.spam_pvoris@earthlink.net> says...
> Oops. My bad. I shoiuld have defined a more in-depth sort routine to
> compare numerically rather than sciibetically. My apologies.
No need to change any more than 'cmp' to '<=>'.
foreach ( sort { $columns{$a}[4] <=> $columns{$b}[4] } keys %columns ) {
print "$_\n";
}
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 18:52:48 GMT
From: Ralph Christopher Furmaniak <ralphcf@home.com>
Subject: Open Source Perl Shell Available
Message-Id: <37C58D78.967F53C4@home.com>
This is a multi-part message in MIME format.
--------------EA204481EC908F5A1A11A891
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Here is a Shell which lets you use perl (or any other interpreter)
commands.
Anything ending in ; gets sent to perl, everything else, to the normal
shell.
It contains an installation script, uninstallation script, and the
shell.
You can improve it if you want, it is written in perl.
First download install, remove, removeall, and baseshell into the same
directory.
Then run
./install /usr/bin/perl (Or any other Interpreter)
This creates a hard link from the shell script to /usr/bin/perlsh which
is the shell that you choose.
This script checks its filename without the sh at the end to see which
interpreter to use.
To remove, run
./remove /usr/bin/perl
Or to remove every shell you made, run
./removeall
Within the shell Anything ending with a semicolon is passed on to perl
and everything else to the normal shell.
Example,
print "hello"; # Sent to Perl
dir # Sent to Normal Shell
To make a sequence of commands which are to be run together, start with
[[ and end with ]]
Example,
[[$ctr = 3;
print $ctr;]]
Type exit to exit
Sincerely,
Ralph Furmaniak
--------------EA204481EC908F5A1A11A891
Content-Type: text/plain; charset=us-ascii;
name="install"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="install"
#!/usr/bin/perl
if($ARGV[0])
{ link("baseshell","$ARGV[0]sh") || die($!);
chmod(0755,"$ARGV[0]sh") || die($!);
open(LIST,">>list") || die($!);
print LIST "$ARGV[0]\n";
close LIST; }
else
{ print "\nUsage : install INTERPRETER\n";
print "Example: install /usr/bin/perl\n"; }
--------------EA204481EC908F5A1A11A891
Content-Type: text/plain; charset=us-ascii;
name="remove"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="remove"
#!/usr/bin/perl
if($ARGV[0])
{ unlink("$ARGV[0]sh"); }
else
{ print "\nUsage : remove INTERPRETER\n";
print "Example: remove /usr/bin/perl\n"; }
--------------EA204481EC908F5A1A11A891
Content-Type: text/plain; charset=us-ascii;
name="removeall"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="removeall"
#!/usr/bin/perl
open(LIST,"list") || die($!);
while($d = <LIST>)
{ chop($d);
system("./remove $d"); }
unlink("list");
--------------EA204481EC908F5A1A11A891
Content-Type: text/plain; charset=us-ascii;
name="baseshell"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="baseshell"
#!/usr/bin/perl
$shell = $0;
$shell =~ s/sh//;
print "\n\nRunning $shell Shell\n\n";
&prompt;
while(($command = <STDIN>) ne "exit\n")
{ chop($command);
if (!($command =~ /.*;/))
{ system($command); }
else
{ if ($command =~ /\[\[.*/)
{ $done = 0;
while(!$done)
{ &prompt;
$add = <STDIN>;
chop($add);
$command = "$command\n$add";
if($command =~ /.*\]\]/)
{ $done = 1;
$command =~ s/\[\[//;
$command =~ s/\]\]//; }
}
}
open(SHELL, "|$shell");
print SHELL "$command\n";
close SHELL;
}
&prompt;
}
sub prompt
{ if($dir = $ENV{'PWD'})
{ if($ENV{'HOME'})
{ $dir =~ s/$ENV{'HOME'}/~/; } }
else
{ $dir = ""; }
print "\n[".$ENV{'LOGNAME'}.' '.$dir.']$ '; }
--------------EA204481EC908F5A1A11A891--
------------------------------
Date: Thu, 26 Aug 1999 18:27:54 GMT
From: Andy Molnar <anmolnar@videon.wave.ca>
Subject: Re: Pattern Matching
Message-Id: <37C58703.61700427@videon.wave.ca>
Edward Sumerfield wrote:
> if m/.*?\*$/ { print "this is untested but it looks right" }
>
> the trailing $ indicates end of line.
>
Hmm, no, that didn't seem to work. I'm sure the syntax is correct, but the
CGI script doesn't want to accept it. How about checking if the last
character is a period, and if it is, then substitute for something else, like
a "*". Then I'll change it back to a period when it gets processed. How
would I do that?
Pattern Matching Ignorant Andy
------------------------------
Date: Thu, 26 Aug 1999 11:49:25 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Pattern Matching
Message-Id: <MPG.122f2c0e15a62a11989eb4@nntp.hpl.hp.com>
In article <37C57128.58820052@videon.wave.ca> on Thu, 26 Aug 1999
16:54:37 GMT, Andy Molnar <anmolnar@videon.wave.ca> says...
> How do use pattern matching to check only the last character of a
> string? I'm passing a value with a period at the end, which seems to
> screw up at the destination. (Such as "Washington D.C."). I can tack
> on another character before sending to "buffer" the period (such as
> "Washington D.C.*", which I'll later encode to "Washington%20D.C.%2A"),
> but I don't know how to check for that "*" character after passing it,
> except for splitting each character, and going through a loop to reach
> the last.
substr $string, -1
gives the last character of a string. It can also be done with a regex,
of course.
> On another note:
> I don't know ANYTHING about pattern matching. And I won't be going to
> any classes until the spring. Are there any good Perl resources with
> pattern matching and a pedagogical approach on the net?
I've seen this recommended in this group (not Win32-centric):
http://www.netcat.co.uk/rob/perl/win32perltut.html
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 11:26:09 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: print dollar format?
Message-Id: <MPG.122f269c9cd05992989eb0@nntp.hpl.hp.com>
In article <5dfx3.8$UK.246@chrome.eng.netapp.com> on Thu, 26 Aug 1999
10:55:18 -0700, Phil Schaechter <phil@proteacher.com> says...
> Count the number of digits. The rest is easy.
>
> print strlen % 3 digits, then a comma, then three digits, then comma until
> you hit . - then print remaining digits..
So let's see: Print 0, 1 or 2 digits, then a comma, ... That doesn't
seem right somehow.
I wonder if I could find a better answer in the FAQ. I'll try `perldoc
-q comma`. And guess what:
Found in d:\perl\lib\pod\perlfaq5.pod
How can I output my numbers with commas added?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 26 Aug 1999 11:24:16 -0700
From: Samay <samay1NOrmSPAM@hotmail.com>
Subject: Re: Regex Question
Message-Id: <136f266c.1bf9d858@usw-ex0106-048.remarq.com>
Yep, It worked.
thanks..
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Thu, 26 Aug 1999 11:34:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sorting by third field in a random access database
Message-Id: <MPG.122f2884f2afb8a3989eb3@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <7q3men$495$1@nclient11-gui.server.virgin.net> on Thu, 26 Aug
1999 14:53:42 +0100, LinksNetwork Admin <andrew@linksnetwork.com>
says...
> I have a large database in which every record is 415 bytes long. There are
> two 5-byte fields followed by a 50-byte field, plus others. I want to sort
> the whole lot in ascending alphabetical order by the third field.
Minimal efficiency, simplest coding:
@out = sort { substr($a, 10, 50) cmp substr($b, 10, 50) } @in;
Maximal efficiency, slightly more complex coding:
@out = map substr($_, 50) =>
sort
map substr($_, 10, 50) . $_ => @in;
This is the "Super String Sort". For more details, see
<URL:http://www.hpl.hp.com/personal/Larry_Rosler/sort/>.
If you have so much data that extra copies in memory simultaneously may
be a burden, look in the paper for 'index sort'.
my $i = 0;
@out = @in[ map substr($_, 50) =>
sort
map substr($_, 10, 50) . sprintf('%.7d' => $i++) =>
@in ];
These various approaches should be benchmarked against your dataset.
YMMV.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 26 Aug 1999 13:08:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: The extent of double-quotish interpolation
Message-Id: <slrn7sb0ll.n0r.abigail@alexandra.delanet.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMCLXXXVI September
MCMXCIII in <URL:news:m1k8qi78pe.fsf@halfdome.holdit.com>:
.. >>>>> "Lauren" == Lauren Smith <laurensmith@sprynet.com> writes:
..
.. Lauren> I'm somewhat surprised that "$f->()" does not make the call to the sub,
.. Lauren> but "$a[$f->()]" does.
..
.. This is simple, when you remember the very simple rule:
..
.. Perl doesn't interpolate expressions, just variables.
Really? Tell me, which variable is interpolated in:
"${\+3}"
Abigail
--
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 26 Aug 1999 14:49:11 -0400
From: elflord@panix.com (Donovan Rebbechi)
Subject: Timeing out "new Net::FTP"
Message-Id: <slrn7sb316.3j2.elflord@panix3.panix.com>
Hi. I am working on a program that uses Net::FTP
If I try to open an FTP connection when the machine is not connected,
I get a hang ( probably because it's waiting for DNS to resolve )
So I've used an eval block to time it out:
eval
{
alarm ( $self->{TMOUT} ) ;
$self->{ftp}=new Net::FTP(@args);
alarm(0);
};
The operation times out just fine, but if I try to connect again later
in the program, it doesn't work ( it seems that the socket is somehow
tied up, even though the ftp object is "undef" )
Any ideas on what's giong on and how I can fix it ?
thanks
--
Donovan
------------------------------
Date: 26 Aug 1999 13:25:09 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: want to start a cgi-programm when someone visits my site...
Message-Id: <slrn7sb1lq.n0r.abigail@alexandra.delanet.com>
Claus Prüfer (pruefer@idnet.de) wrote on MMCLXXXVI September MCMXCIII in
<URL:news:7q3qmj$585$1@news.gigabell.net>:
~~ hi there,
~~ ive got a small perl-problem. if someone visits my homepage, i want to start
~~ a perl-script (cgi), which counts the hits on the page...
~~ where should i place the "LINK?" in the html-code ???
To count things in Perl, you would do: $count ++;
Where to place 'LINK?' isn't a Perl question.
Abigail
--
$" = "/"; split // => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%_ = (Just => another => Perl => Hacker); &{%_};
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 26 Aug 1999 13:27:47 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: where command is coming from
Message-Id: <slrn7sb1qn.n0r.abigail@alexandra.delanet.com>
Blair Heuer (ab@cd.com) wrote on MMCLXXXVI September MCMXCIII in
<URL:news:7q3s4c$c8g$1@holly.prod.itd.earthlink.net>:
"" It was a perl question, a cgi perl question, i guess you could say. Is this
"" message board only for perl that is not CGI? I thought it was any perl
"" considering it is miscelaneous. If I am wrong, please tell me, so I can find
"" a more appropriate board, and not bother people.
1) This isn't a message board, this is a newsgroup.
2) Jeopardy is a television program, and should not be used in newsgroups.
3) The fact your CGI program is written in Perl is irrelevant. You use
a keyboard to type the program in, but you don't consider the question
a keyboard question, do you?
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Thu, 26 Aug 1999 11:37:26 -0700
From: "Phil Schaechter" <phil@proteacher.com>
Subject: Re: where command is coming from
Message-Id: <CQfx3.9$UK.233@chrome.eng.netapp.com>
Let's attempt to be a little more polite, mmmkay?
Phil
Greg Bacon wrote in message <7q1htl$kui$3@info2.uah.edu>...
>In article <7q1f78$obj$1@ash.prod.itd.earthlink.net>,
> "Blair Heuer" <ab@cd.com> writes:
>
>: If I could get the url of the file from which the form was sent, then I
>: could check to make sure it was the same, so that people do not edit the
>: files hidden inputs (if they do, it will cause a huge security issue...
>: anyone can freely go throughout my computer and read/delete/etc whatever
>: they want).
>
>Do you have a Perl question at all? If you have CGI questions, maybe
>you should find a newsgroup that, I don't know, has CGI in its name.
>Maybe I'm just crazy.
>
>Greg
>--
>Don't worry about people stealing your ideas. If your ideas are any good,
>you'll have to ram them down people's throats.
> -- Howard Aiken
------------------------------
Date: 26 Aug 1999 18:55:14 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: where command is coming from
Message-Id: <7q42ii$7bg$1@info2.uah.edu>
In article <7q3s4c$c8g$1@holly.prod.itd.earthlink.net>,
"Blair Heuer" <ab@cd.com> writes:
: It was a perl question, a cgi perl question, i guess you could say.
A question isn't necessarily a Perl question just because you happen to
be implementing a particular application in Perl.
: Is
: this message board only for perl that is not CGI?
This newsgroup is for discussion of the Perl language. Questions about
Perl (that aren't already answered in the FAQ) are best asked here.
There is another newsgroup called comp.infosystems.www.authoring.cgi
that is for the discussion of the Common Gateway Interface. Questions
about the Common Gateway Interface are best asked there.
: I thought it was any
: perl considering it is miscelaneous.
Where should one ask the following questions?
- I'm writing an investment advisor program in Perl. How should I
choose which stocks to recommend to the user?
- I'm writing an investment advisor program in C. How should I
choose which stocks to recommend to the user?
- I'm writing an investment advisor program in Forth. Stocks the
user to recommend to choose I how should?
Do you really and honestly think those questions belong in clpmisc,
comp.lang.c, and comp.lang.forth respectively? Don't you agree that
they'd belong more in an investment discussion group?
: If I am wrong, please tell me, so
: I can find a more appropriate board, and not bother people.
CGI questions are best asked in comp.infosystems.www.authoring.cgi (aka
ciwac).
: BTW I found what I needed on some CD while doing something else. What I
: needed was HTTP_REFERER.
Do you understand, though, that the CGI protocol is a conceptual level
up from how it's implemented? The CGI protocol says to examine the
HTTP_REFERER [sic :-(] environment variable. In Perl, you might do
something like
my $referrer = $ENV{HTTP_REFERER};
but in C, you might do something like
referrer = getenv("HTTP_REFERER");
Do you see the difference?
Greg
--
Why do they lock gas station bathrooms? Are they afraid someone will
clean them?
-- George Carlin
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. Due to their sizes, neither the Meta-FAQ nor
the FAQ are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq" from
almanac@ruby.oce.orst.edu.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 655
*************************************