[11686] in Perl-Users-Digest
Perl-Users Digest, Issue: 5286 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 2 16:04:58 1999
Date: Fri, 2 Apr 99 13:00:26 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 2 Apr 1999 Volume: 8 Number: 5286
Today's topics:
Re: ActivePerl win32 and fork() ?? Does it work on any <dboorstein@ixl.com>
Alternative for Perl <debot@xs4all.nl>
Re: Alternative for Perl <ddelikat@protix.com>
Re: Alternative for Perl <fvdm@dds.nl>
Re: Can you return hashes in subroutines? (Krusty276)
Re: Can you return hashes in subroutines? <All@n.due.net>
Re: cant run perl from windows <debot@xs4all.nl>
Re: cant run perl from windows Don.Carlton@Citadel.edu
Re: constructing a list of hashes <hojo@i-tel.com>
Re: Hashes as configuration files, appending to @INC to <dboorstein@ixl.com>
Re: Help with Sorting Routine (Larry Rosler)
Help: Problems with FTP <richk@minn.net>
Re: How to remove repeated signs ? <ebohlman@netcom.com>
Re: How to remove repeated signs ? (Larry Rosler)
LWP and Put on Windows NT <cristenc@cnet.com>
Re: RegEx question <aperrin@mcmahon.qal.berkeley.edu>
Re: Running CGI scripts OFFLINE (Bob Trieger)
Re: Running CGI scripts OFFLINE <gregm@well.com>
Re: Sending a email using PERL (Larry Rosler)
Re: SQL help please (newbie question) <ebohlman@netcom.com>
Re: SQL help please (newbie question) <gregm@well.com>
Re: Sun Microsystems Sponsors Perl Mongers (brian d foy)
Re: two questions need help <droby@copyright.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 02 Apr 1999 14:46:47 -0600
From: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: ActivePerl win32 and fork() ?? Does it work on any win platform?
Message-Id: <37052CB7.73595516@ixl.com>
"David L. Cassell" wrote:
>
> Davekonz wrote:
> > Is fort() a working function on any win32 platform. I know it is not on win95.
> > Does it work on win98 or NT ( lets say 4.0 or later )..
>
> You mis-typed fork(), but fat-fingering is a common disorder. :-)
> No, there is no fork() on any win32 platform. If you want, you could
> download ActiveState's build 513 which has threads as an *experimental*
> feature. Caveat utor. Don't use it for anything that's mission-critical.
I think this is stated a bit too strongly:
$ perl -e 'print fork, "\n"'
0
332
$ perl -e 'print $^O, "\n"'
uwin-nt
you can get fork() in the UWIN distribution of perl, but i'm not sure
how it will react once outside their implementation of ksh.
check out <URL:http://www.research.att.com/sw/tools/uwin/> for more
info.
cheers,
danboo
------------------------------
Date: Fri, 02 Apr 1999 21:19:12 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Alternative for Perl
Message-Id: <3705182F.22C91229@xs4all.nl>
Is there an other language to replace perl, which is much faster?
Currently I have a database and I think when It's grown bigger, it will
ask too much of my computers capicity.
--
My Email : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
- http://www.searchy.net/
------------------------------
Date: Fri, 02 Apr 1999 13:33:12 -0600
From: David Delikat <ddelikat@protix.com>
Subject: Re: Alternative for Perl
Message-Id: <37051B78.4487@protix.com>
Frank de Bot wrote:
>
> Is there an other language to replace perl, which is much faster?
> Currently I have a database and I think when It's grown bigger, it will
> ask too much of my computers capicity.
>
> --
> My Email : debot@xs4all.nl
> Homepages : - http://www.debot.nl/ppi/
> - http://www.searchy.net/
someone could write a perl compiler.
otherwise, there's C++, Java, Delphi...
or you could get a faster computer.
-dav
--
<((((><
Consultant: Internet, Database, Business Systems
Unix/Linux, Windows95/NT
mailto:david-delikat@usa.net / http://obj.webjump.com/
------------------------------
Date: Fri, 2 Apr 1999 22:24:54 +0200
From: "Frank" <fvdm@dds.nl>
Subject: Re: Alternative for Perl
Message-Id: <7e38nr$48n$1@news2.xs4all.nl>
Frank de Bot wrote in message <3705182F.22C91229@xs4all.nl>...
>Is there an other language to replace perl, which is much faster?
>Currently I have a database and I think when It's grown bigger, it will
>ask too much of my computers capicity.
If you are using Windows NT and IIS3/4 than use ASP. It's fast. It's easy...
Frank.
------------------------------
Date: 2 Apr 1999 19:11:10 GMT
From: krusty276@aol.com (Krusty276)
Subject: Re: Can you return hashes in subroutines?
Message-Id: <19990402141110.06058.00001655@ng101.aol.com>
that other function worked returning a hash, but for mine below, I can't seem
to get the right results. And my local %hash to make_hash is global in the
fucntion below. What am I doing wrong??
#!/usr/local/bin/perl -w
#use strict;
sub make_hash {
my %hash;
$hash[2][1]="3";
return %hash; #also tried \%
}
my %t_hash=&make_hash();
#my %t_hash = %{ make_hash()};
print ("t_hash=$#t_hash\n"); #I want to see 2 here but I get a -1!
print ("hash=$#hash\n"); #I get a 2 here but I want a -1! isn't %hash local to
make_hash???
>
>Krusty276 <krusty276@aol.com> wrote in message
>news:19990401200801.06059.00000981@ng101.aol.com...
>: I'm having mad problems. Like I say:
>: %get_hash_value= &sub_make_hash(@some_list);
>: sub sub_make_hash{
>: (local %return_this_hash);
>: XXXXX(all function making %return_this_hash )
>: return (%return_this_hash);
>: }
>:
>: When I do this I get nothing back for get_hash_value.
>: but in the main part I can get the values for %return_this_hash, if I use
>that
>: name, but I declared it local to the subroutine.
>: Are hashes always global.
>: This is Perl5, active Perl for win32
>
>I am not sure what the problem is except that local should be a my. Hashes
>are not global, see below. Here is an example that returns a hash tested
>under Win98, activestate perl.
>
>#!/usr/local/bin/perl -w
>use strict;
>my @ingredients = qw(first beef second potatoes third onions);
>
>sub make_hash {
> my %hash;
> print "Warning, uneven number of elements in array.\n" if (@_ % 2 != 0);
> for(my $i=0; $i <= $#_;$i+=2) {
> $hash{$_[$i]} = $_[$i+1];
> }
> return %hash;
>}
>
>my %hash = make_hash(@ingredients);
>print "$_ ingredient: $hash{$_}\n" foreach keys %hash;
>
>HTH
>
>AmD
>
>
>
>
>
>
>
>
>
------------------------------
Date: Fri, 02 Apr 1999 20:43:05 GMT
From: "Allan M. Due" <All@n.due.net>
Subject: Re: Can you return hashes in subroutines?
Message-Id: <tZ9N2.69$gr5.77@news.rdc1.ct.home.com>
Krusty276 <krusty276@aol.com> wrote in message
news:19990402141110.06058.00001655@ng101.aol.com...
: that other function worked returning a hash, but for mine below, I can't
seem
: to get the right results. And my local %hash to make_hash is global in
the
: fucntion below. What am I doing wrong??
Not reading the docs and not using use strict <g>.
: #!/usr/local/bin/perl -w
: #use strict;
:: sub make_hash {
: my %hash;
: $hash[2][1]="3";
: return %hash; #also tried \%
: }
: my %t_hash=&make_hash();
: print ("t_hash=$#t_hash\n"); #I want to see 2 here but I get a -1!
: print ("hash=$#hash\n"); #I get a 2 here but I want a -1! isn't %hash
local to
: make_hash???
Yikes, you really should not have commented out the use strict. The error
messages it provides should have told you what is going on. One error
message would be "Global symbol "@hash" requires explicit package name..."
This is a clue that the thing you think is a hash is not. The line
$hash[2][1]="3";
creates a multi-dimensional array and sets element 2,1 to 3. I don't think
this is what you want. This @hash array is global because it is not a hash,
it is an array named hash. The hash itself, which you never use, is not
global. To add elements to a hash you write something like:
$hash{$key} = $value;
so I really don't know what you are trying to get when you use
$hash[2][1]="3";
You also cannot get the number of elements in a hash by using $#hash. In
your example you get a -1 for $#t_hash because it never exists. $#t_hash
asks for subscript of the last element of the array @t_hash, which does not
exist. This is the second warning that use strict would have produced:
Global symbol "@t_hash" requires explicit package name at...
Of course the hash %t_hash is empty because %hash in the sub is never used.
@hash is global so you get the 2.
I would strongly suggest a bit more time with the documentation.
Now if what you are trying to do is manipulate multi-dimensional arrays,
that is a whole different kettle of fish.
HTH
AmD
------------------------------
Date: Fri, 02 Apr 1999 21:21:45 +0200
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: cant run perl from windows
Message-Id: <370518C8.DBBA6A81@xs4all.nl>
Do you have the win32 version of perl? You can download it here:
http://www.activestate.com/ . To let it run in your browser, you download Apache
(http://www.apache.org). ( Further instruction are then included)
mikecard@my-dejanews.com wrote:
> hi there
>
> i'm new to perl. i am making my first web site and i want to give it some
> interactivity, so i am trying to get my cgi scripts working before i put them
> online.
>
> i downloaded the perl program that runs on windows. i made a script very
> basic script called first.pl and i open up the perl program. from the
> command line i type perl first.pl and hit enter and nothing happens. how do
> i run perl from windows
>
> mike cardeiro
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
--
My Email : debot@xs4all.nl
Homepages : - http://www.debot.nl/ppi/
- http://www.searchy.net/
------------------------------
Date: Fri, 02 Apr 1999 19:40:40 GMT
From: Don.Carlton@Citadel.edu
Subject: Re: cant run perl from windows
Message-Id: <7e36fn$ub7$1@nnrp1.dejanews.com>
In article <7e2per$irh$1@nnrp1.dejanews.com>,
mikecard@my-dejanews.com wrote:
> hi there
>
> i'm new to perl. i am making my first web site and i want to give it some
> interactivity, so i am trying to get my cgi scripts working before i put them
> online.
>
> i downloaded the perl program that runs on windows. i made a script very
> basic script called first.pl and i open up the perl program. from the
> command line i type perl first.pl and hit enter and nothing happens. how do
> i run perl from windows
You do not open up the perl program!!! You get a dos command prompt and key
in perl first.pl
>
> mike cardeiro
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 02 Apr 1999 20:21:46 GMT
From: hojo <hojo@i-tel.com>
Subject: Re: constructing a list of hashes
Message-Id: <7e38sg$gb$1@nnrp1.dejanews.com>
> > Allow me to correct my statements. The program works. With the -wT on
it
> > states the following: Use of uninitialized value at ./p1 line 15. It
> > complains, but runs anyway. I really asked the question in the interests of
> > clean programming. Thanks.
Here is the program:
#!/usr/bin/perl -wT
#
###################################
use strict;
###################################
my @test;
my $tnew = {};
print "\n######Begin######";
$test[81]=$tnew;
print "\n$test[81]{27} ---\n";
$test[81]{27}++;
print "\n$test[81]{27} ---\n";
print "\n######End######";
Here is the output:
Use of uninitialized value at ./p1 line 10.
######Begin######
---
1 ---
######End######
perl -V:
Summary of my perl5 (5.0 patchlevel 5 subversion 2) configuration: Platform:
osname=linux, osvers=2.0.31, archname=i586-linux uname='linux
greenland.i-tel.com 2.0.31 #1 sun nov 9 21:45:23 est 1997 i586 unknown '
hint=previous, useposix=true, d_sigaction=define usethreads=undef
useperlio=undef d_sfio=undef Compiler: cc='gcc', optimize='-O2',
gccversion=2.7.2.3 cppflags='-Dbool=char -DHAS_BOOL -DDEBUGGING
-I/usr/local/include' ccflags ='-Dbool=char -DHAS_BOOL -DDEBUGGING
-I/usr/local/include' stdchar='char', d_stdstdio=define, usevfork=true
intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define,
longlongsize=8, d_longdbl=define, longdblsize=12 alignbytes=4,
usemymalloc=y, prototype=define Linker and Libraries: ld='ld', ldflags ='
-L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm
-lc -lposix -lcrypt libc=, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=none, d_dlsymun=undef,
ccdlflags='-rdynamic -Wl,-r path,/usr/lib/perl5/5.00502/i586-linux/CORE'
cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING
Built under linux
Compiled at Jan 28 1999 15:15:39
@INC:
/usr/lib/perl5/5.00502/i586-linux
/usr/lib/perl5/5.00502
/usr/lib/perl5/site_perl/5.005/i586-linux
/usr/lib/perl5/site_perl/5.005
.
-------------------------------------------------------------
=-=-=-=-=-=-=-=-=-=
David Hajoglou
Sys. Admin., Abbreviator
=-=-=-=-=-=-=-=-=-=
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 02 Apr 1999 14:27:58 -0600
From: Dan Boorstein <dboorstein@ixl.com>
Subject: Re: Hashes as configuration files, appending to @INC to find them
Message-Id: <3705284E.DCD2848F@ixl.com>
Andrew S Gianni wrote:
>
[snip]
> files as perl hashes and just require the file. With benchmarking, this
> seems to take about a quarter the time of splitting and storing (which
> didn't shock me or anything) Any comments on this?
sure... good idea if only perl needs to get at these files. and if
you're not using Data::Dumper, i recommend it.
[snip]
> information is in. My idea was to unshift all those directories onto
> @INC and then just do a
> require "<username>" and let perl do the math. I benchmarked this
> against something like /([a-z][a-z]).*/; require "$1/<username>"; and
> using @INC seems to come out being something like a sixth of the time.
> Are there any drawbacks to doing something like this? Would it cause
> problems if I'm also requiring other stuff, because @INC is so large at
> this point, or are the performance issues minimal?
well since you're using 'unshift' instead of 'push' all of your
user directories are first. this means that trying to use a module
will result in all the user directories being searched first.
luckily 'use' and 'require' only need happen once but since you
seemed so concerned with speed (perhaps overly :) ...
use Benchmark;
$^W = 0;
@orig = @INC;
timethis (500, sub { do 'Benchmark.pm' }, 'standard');
@INC = (1 .. 676, @orig);
timethis (500, sub { do 'Benchmark.pm' }, 'unshift');
@INC = (@orig, 1 .. 676);
timethis (500, sub { do 'Benchmark.pm' }, 'push');
__END__
standard: 9 wallclock secs ( 8.90 usr + 0.78 sys = 9.68 CPU)
unshift: 315 wallclock secs (23.81 usr + 289.86 sys = 313.67 CPU)
push: 10 wallclock secs ( 9.12 usr + 0.62 sys = 9.74 CPU)
Yikes! a 30 fold increase in time. It took about .6 seconds for
each 'do'. if the requires you do for other files are numerous
or you need to require many users near the end of @INC, i
think you'll see your startup time and runtimes increasing. with
the letter-extraction method you don't really care if you're
looking up 'aardvark' or 'zztop'.
Additionally, if you know that all user names begin with two
letters you could speed up your regex by binding it or use
'substr':
use Benchmark;
$name = $start = 'wodawick mcfadden';
timethese (500000, {
'unbound' => sub { $name =~ /([a-z][a-z]).*/;},
'bound' => sub { $name =~ /^([a-z][a-z])/;},
'substr' => sub { $start = substr($name, 0, 2) },
});
__END__
Benchmark: timing 500000 iterations of bound, substr, unbound...
bound: 2 wallclock secs ( 2.44 usr + 0.00 sys = 2.44 CPU)
substr: 2 wallclock secs ( 1.39 usr + 0.00 sys = 1.39 CPU)
unbound: 3 wallclock secs ( 3.07 usr + 0.00 sys = 3.07 CPU)
Doesn't make up the six-fold difference you're seeing, but it could
help.
cheers,
danboo
------------------------------
Date: Fri, 2 Apr 1999 12:22:51 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Help with Sorting Routine
Message-Id: <MPG.116ec6f2293df11198981c@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <mjsvqOSf#GA.228@newstoo.hiwaay.net> on Fri, 2 Apr 1999
10:11:35 -0600, The Crowe <crowe@darkspiral.com >says...
> I need some help with a sorting routine. I've read the sections in
> Learning Perl, Programming Perl and the Perl Cookbook and I still
> can't figure out how to get this to work.
The techniques you seek (sorting on multiple fields) are described in
perlfaq4: "How do I sort an array by (anything)?" and in the FMTEYEWTK
it points to. There is also a CPAN module that supports fielded sorts,
but I haven't used it.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 02 Apr 1999 14:06:04 -0600
From: Rich Koland <richk@minn.net>
Subject: Help: Problems with FTP
Message-Id: <3705232C.3AAF268E@minn.net>
Hi,
I hope someone can help me decipher what is going wrong with my FTP
script.
First some background - we are trying to ftp files from a web server
outside a firewall to a server inside the firewall. This process needs
to be fully automated so we should not have to intervene. The script
that is having a problem is the one that creates the FTP and transfers
it to a intermediate server. Once on that the server it renames the
files and exits.
System: We are using PERL 5.004 on Sun Solaris 7 & WU FTP. We are also
using the Net::FTP module.
Here is what is happening every time that the script tries to rename a
the new file or list the directory contents a "Unexpected EOF..."
message is displayed in the debugging output and the script dies. The
function "err_log" performs a couple of cleanup steps and the exits with
a die command.
Code Snippet:
=============================
line #199 --> @filelist = $ftp->ls() or &err_log("ftp_get","Couldn't
retrieve the file information on $new_name : error = $!", -1);
Error Message from FTP
===========================
Net::FTP=GLOB(0x359cbc)<<< 200 PORT command successful.
Net::FTP=GLOB(0x359cbc)>>> LIST /***********/rkoland/db_data
Net::FTP=GLOB(0x359cbc)<<< 150 Binary data connection for /bin/ls
(192.149.76.240,52227) (0 bytes).
Net::FTP=GLOB(0x359cbc)>>> ABOR
Net::FTP=GLOB(0x359cbc)<<< 226 Binary Transfer complete.
Net::FTP=GLOB(0x359cbc)<<< 221 You could at least say goodbye.
File 1 -> Default value
Net::FTP=GLOB(0x359cbc)>>> PORT 192,149,76,240,204,4
Net::FTP: Unexpected EOF on command channel at ftp_put.pl line 199
As you can see, I am getting past the 'ls' command, but I am not getting
the expected results.
Any ideas????
TIA
Rich Koland
Web Developer
National Marrow Donor Program
rkoland@nmdp.org
------------------------------
Date: Fri, 2 Apr 1999 19:22:01 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: How to remove repeated signs ?
Message-Id: <ebohlmanF9Ktsp.893@netcom.com>
Larry Rosler <lr@hpl.hp.com> wrote:
: In article <htt1e7.6sb.ln@magna.metronet.com> on Fri, 2 Apr 1999
: 03:08:17 -0500, Tad McClellan <tadmc@metronet.com >says...
: > squish consecutive characters (or character sequences):
: >
: > 1 while s/(.)\1/$1/;
: What an odd way to write the 'g' modifier! (As I posted, the 's' method
: is hideously slower than the 'tr' method. But 'tr' won't work on
: character sequences, as you say.)
This isn't equivalent to s/(.)\1/$1/g -- the latter will only remove
every other consecutive character, because it skips past the character it
just replaced. The string really does have to be rescanned from the
beginning (or at least the place where the first match occurred).
------------------------------
Date: Fri, 2 Apr 1999 12:10:27 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to remove repeated signs ?
Message-Id: <MPG.116ec408b00c77d998981b@nntp.hpl.hp.com>
In article <ebohlmanF9Ktsp.893@netcom.com> on Fri, 2 Apr 1999 19:22:01
GMT, Eric Bohlman <ebohlman@netcom.com >says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> : In article <htt1e7.6sb.ln@magna.metronet.com> on Fri, 2 Apr 1999
> : 03:08:17 -0500, Tad McClellan <tadmc@metronet.com >says...
> : > squish consecutive characters (or character sequences):
> : >
> : > 1 while s/(.)\1/$1/;
>
> : What an odd way to write the 'g' modifier! (As I posted, the 's' method
> : is hideously slower than the 'tr' method. But 'tr' won't work on
> : character sequences, as you say.)
>
> This isn't equivalent to s/(.)\1/$1/g -- the latter will only remove
> every other consecutive character, because it skips past the character it
> just replaced. The string really does have to be rescanned from the
> beginning (or at least the place where the first match occurred).
You are right about the failure of the regex as presented, but wrong
about having to rescan the string in a loop to make it work. I noted
the missing '/g' but overlooked the also missing '+' on the '\1'.
Several of us have posted that correctly:
s/(.)\1+/$1/g;
But the 'tr' solution is an order of magnitude faster, according to the
benchmark I posted. Think of how many billions of CPU cycles are being
wasted by people using 's' instead of 'tr' for single-character
manipulations. < MOCK :-( > I doubt that this performance preference
is clear in any of the docs or tutorials.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 02 Apr 1999 12:02:59 -0800
From: Cristen Carvis <cristenc@cnet.com>
Subject: LWP and Put on Windows NT
Message-Id: <37052273.A7F71F0F@cnet.com>
Hi ~
I'm having problems using the LWP module to PUT a file from my NT
machine onto a UNIX machine. I'm getting the ftp return code 553 - which
I've found to mean:
553 Requested action not taken.
File name not allowed.
Here's what I'm doing:
my $ftpReq = new HTTP::Request PUT =>
'ftp://username:password@machine.cnet.com//the directory/';
$ftpReq->content('tip.txt');
my $ftpRes = $ua->request($ftpReq);
print $ftpRes->message();
I've also tried this:
$ftpReq->content('c:\WINNT\Profiles\cristenc\Desktop\tip.txt','tip.txt');
but that doesn't seem to work either.
Any suggestions?
(I haven't been able to find detailed documentation on using PUT.)
Thanks!
~ Cristen
------------------------------
Date: Fri, 02 Apr 1999 11:19:23 -0800
From: Andrew Perrin <aperrin@mcmahon.qal.berkeley.edu>
To: Ketan Patel <ketanp@BLAHNOSPAMBLAHxwebdesign.com>
Subject: Re: RegEx question
Message-Id: <3705183A.2C82B822@mcmahon.qal.berkeley.edu>
[posted & sent via e-mail]
Not sure exactly what you're looking for...
If all your lines really are exactly the same, you can do something like:
if ($response=~ /<TD><FONT SIZE=-1\ COLOR=black\ FACE=\"Times\ New\
Roman\"><(.*)><\/FONT><\/TD>/) {
$value = $1;
}
but that assumes everything's exactly the same. You can play with it
though; maybe something like:
/<TD><FONT.*><(.*)>/
would serve you equally well.
Good luck-
Andy Perrin
Ketan Patel wrote:
> I get a file similar to the one at the bottom of the message after
> doing:
>
> my $response = $ua->request($request);
> my $string = $response->as_string;
> print $string;
>
> Now, from $string I would like to get the values that are on the lines
> similar to:
>
> <TD><FONT SIZE=-1 COLOR=black FACE="Times New Roman"><*****value is
> here*****></FONT></TD>
>
> There are 10 lines that match that format, and I'd like to get the
> values that are in them... How would I do that on one long string? How
> could I narrow it down to just the values inside the HTML tags?
>
> Thanks in advance for any help you can provide!
--
-------------------------------------------------------------
Andrew J. Perrin - NT/Unix/Access Consulting - (650)938-4740
aperrin@mcmahon.qal.berkeley.edu (Remove the Junk Mail King)
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: Fri, 02 Apr 1999 18:40:07 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <7e32qp$5pn$1@ash.prod.itd.earthlink.net>
"Matt" <matt@gapps.co.uk> wrote:
^>I was wondering if there was any software about that would let you run CGI
^>scripts offline in a windows enviroment.
^>
^>This would be very useful as it would save a lot of online testing
CGI.pm does this quite well and the smallest amount of research would have
uncovered this for you before asking here.
Bob Trieger
sowmaster@juicepigs.com
------------------------------
Date: Fri, 02 Apr 1999 11:41:12 -0800
From: Greg McCann <gregm@well.com>
Subject: Re: Running CGI scripts OFFLINE
Message-Id: <37051D58.C6DE3CAF@well.com>
See http://www.troubleshooters.com/codecorn/littperl/perlcgi.htm for a
possible solution.
Greg
Matt wrote:
>
> I was wondering if there was any software about that would let you run CGI
> scripts offline in a windows enviroment.
>
> This would be very useful as it would save a lot of online testing
>
> Please mail responses to :-
>
> matt@gapps.co.uk
--
======================
Gregory McCann
http://www.calypteanna.com
"Be kind, for everyone you meet is fighting a great battle." Saint
Philo of Alexandria
------------------------------
Date: Fri, 2 Apr 1999 12:43:31 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Sending a email using PERL
Message-Id: <MPG.116ecbc6d479c0f498981d@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <yO6N2.1536$04.1237@stones> on Fri, 2 Apr 1999 18:04:50
+0100, Sandwell <JK@sandwell98.free-online.co.uk >says...
> I am writing a script which requires sending a email to the web master. I
> have tried the following script, without much luck. I have pasted the FULL
> script, if you could be give me an ideas??
>
> #!/usr/bin/perl -w
Good start. But where is 'use strict;'?
> $to='graeme\@sandwell98.free-online.co.uk';
> $from='graeme\@sandwell98.free-online.co.uk';
You don't need or want backslashes to protect the @s in these
(correctly) single-quoted strings. The backslashes would become part of
the text.
> $subject='Thank you for your inquiry';
> $text='Dear reader\n\nThank you for your recent inquiry.';
But this string contains the four characters \ n \ n ! Here you need
double-quotes to get the newlines.
> &email($to,$from,$subject,$text);
The & is an unnecessary Perl 4 atavism. And you could spare a space
after each of those commas (and around all your operators!).
> sub email {
> local($to,$from,$sub,$letter) = @_;
Perl 4 again. The proper declaration is 'my', not 'local'.
> $to=~s/@/\@/;
> $from=~s/@/\@/;
Those two lines do nothing. Nothing is needed here, anyway.
> open(MAIL, "|/usr/sbin/sendmail") || die
> "Content-type: text/text\n\nCan't open /usr/lib/sendmail!";
That should be 'text/plain'. And you should include $! in the
diagnostic. Also (though I'm not expert here), I believe this 'open'
succeeds whether or not the pipe is successfully opened. You need to
check the 'close MAIL' to make sure it really worked.
> print MAIL "To: $to\n";
> print MAIL "From: $from\n";
> print MAIL "Subject: $sub\n";
Finally, to your real problem. To end the headers, you need a blank
line.
> print MAIL "$letter\n";
Instead of multiple prints, most of us would prefer a 'here' doc:
print MAIL <<END;
To: $to
From: $from
Subject: $sub
$letter
END
Lots easier to write and to read, no?
And finally, as noted above,
close MAIL or die "...$!";
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 2 Apr 1999 19:24:24 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: SQL help please (newbie question)
Message-Id: <ebohlmanF9Ktwp.8E7@netcom.com>
R&K <rnichols@airnet.net> wrote:
: Could somebody please point me to some internet resources using perl with an
: sql database. Tutorials preferably.
Take a look at <URL:http://reference.perl.com/query.cgi?datadbase>.
------------------------------
Date: Fri, 02 Apr 1999 11:33:56 -0800
From: Greg McCann <gregm@well.com>
To: R&K <rnichols@airnet.net>
Subject: Re: SQL help please (newbie question)
Message-Id: <37051BA4.2DD9FC0F@well.com>
The one that I am somewhat familiar with is the documentation for
Win32::ODBC at http://www.roth.net/odbc. If you are not on Win32, look
for DBD and DBI.
Greg
R&K wrote:
>
> Could somebody please point me to some internet resources using perl with an
> sql database. Tutorials preferably.
>
> Thanks alot
--
======================
Gregory McCann
http://www.calypteanna.com
"Be kind, for everyone you meet is fighting a great battle." Saint
Philo of Alexandria
------------------------------
Date: Fri, 02 Apr 1999 14:16:48 -0500
From: brian@pm.org (brian d foy)
Subject: Re: Sun Microsystems Sponsors Perl Mongers
Message-Id: <brian-ya02408000R0204991416480001@news.panix.com>
In article <hq21e7.cmb.ln@magna.metronet.com>, tadmc@metronet.com (Tad McClellan) posted:
> Maybe the Executive Director can even get a new
> keyboard with a working shift key and everything?
DONE. THANKS FOR THE NEW KEYBOARD!!!
--
brian d foy
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>
------------------------------
Date: Fri, 02 Apr 1999 20:37:49 GMT
From: Don Roby <droby@copyright.com>
Subject: Re: two questions need help
Message-Id: <7e39qs$1e9$1@nnrp1.dejanews.com>
In article <krf0e7.afb.ln@magna.metronet.com>,
tadmc@metronet.com (Tad McClellan) wrote:
> David L. Cassell (cassell@mail.cor.epa.gov) wrote:
>
> : Why doesn't the -T flag
> : check for the taint of immoral activities, so we wouldn't have
> : to worry about this? :-)
>
> I expect that feature is waiting for the (in?)famous
> Net::ESP module to be released.
>
> I occasionally get "a feeling" that it might be on CPAN,
> but when I go check, it is never there :-(
>
Doris is in hiding. S/he's probably coding the -T anti-spam magic right now.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". 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". It appears twice
weekly in the group, but is not distributed in the digest.
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 V8 Issue 5286
**************************************