[11898] in Perl-Users-Digest
Perl-Users Digest, Issue: 5498 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 27 17:07:05 1999
Date: Tue, 27 Apr 99 14:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 27 Apr 1999 Volume: 8 Number: 5498
Today's topics:
Re: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex( (Larry Rosler)
Re: ==> Starting subroutines in here documents <== <aqumsieh@matrox.com>
Re: autoincrement magic a..z (Gregory Snow)
Re: autoincrement magic a..z (Gregory Snow)
can not find the simple.pm wendy1967@my-dejanews.com
count associate array bing-du@tamu.edu
Re: count associate array (Jason)
Re: Country of a visitor <selectthree@gsig-net.qc.ca>
Re: Eliminate elements from array with second array? (Larry Rosler)
Re: FAQ 6.5: How do I substitute case insensitively on (Larry Rosler)
Re: FAQ not applicable (was: Eliminate elements from ar (Larry Rosler)
Re: Free Web Hosting with CGI <supton@soonet.ca>
Re: Help Please! System commands from Win98 Perl CGI homelessinseattle@my-dejanews.com
Re: how to read a huge file line by line without loadin <jeromeo@atrieva.com>
How to use FTP in perl?? <losteven@yahoo.com>
Re: How to use FTP in perl?? <t-armbruster@ti.com>
Re: Monitoring the state of a serial port HELLLPPPPP <tripix@tdi-net.freeserve.co.uk>
newbie: Replace \n with <br>\n <scott@simsbury.com>
Re: On the fly conversion <t-armbruster@ti.com>
Re: On the fly conversion <jeromeo@atrieva.com>
Out of memory <bailey@le0102.pto.ford.com>
Re: Output from eval (Larry Rosler)
Re: Perl->database problem (Jason)
Re: Perl->database problem <t-armbruster@ti.com>
PUZZLED: $query->popup_menu(......) <sushant@ntwrks.com>
Re: PUZZLED: $query->popup_menu(......) (Larry Rosler)
ROUNDING A NUMBER IN PERL <rrahul@uswest.com>
Re: searching perl documentation <cassell@mail.cor.epa.gov>
Re: stupid single quote " wipes out REST OF TEXT <davidk@nospam.cnct.com>
Text Counter <khschulz@yahoo.com>
Re: Text Counter <t-armbruster@ti.com>
Re: what's wrong with $x = $y or "" <ludlow@us.ibm.com>
Re: what's wrong with $x = $y or "" <davidk@nospam.cnct.com>
Where find a2p? <aaronr@spiritone.com>
Re: Win32, Word <el@lisse.na>
Re: Win32, Word <camerond@mail.uca.edu>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Apr 1999 11:02:50 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
Message-Id: <MPG.118f9ba3f1cce9aa989950@nntp.hpl.hp.com>
In article <7g4rrh$g9d$1@anathema.red.roses.de> on 27 Apr 1999 19:24:01
+0200, Hans Maurer <hans@nosports.red.roses.de> says...
> Benjamin Franz wrote:
> > my ($tick) = @_;
> > my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst,
> > $month,$wkday);
> > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=gmtime($tick);
> [...]
> > if ($year < 95) {
> > $year = $year + 2000
> > }
> > if (($year > 94) && ($year < 1000)) {
> > $year = $year + 1900;
> > }
>
> I see year-mangling stuff like this all the time. As the perlfunc man page
> says (backed up by any gmtime or localtime man page):
> Also, $year is the
> number of years since 1900, that is, $year is 123 in
> year 2023, not simply the last two digits of the
> year.
> So, a simple $year+=1900; does the trick. The code above will fail for
> time stamps earlier than 01/01/1995.
>
> Is there an issue on NT with gmtime that needs work-arounds like the one
> above?
No.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 13:37:36 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: ==> Starting subroutines in here documents <==
Message-Id: <x3yg15mq80x.fsf@tigre.matrox.com>
ijg@csc.liv.ac.uk (I.J. Garlick) writes:
> > #!/usr/local/bin/perl -w
> >
> > sub lurch
> > {
> > $x="abcdefghijklmn";
> > @tmp=split(//,$x);
> > $y=join("\n",@tmp);
> > return($y);
> > }
>
> Yukk.
> perhaps one of the gurus could point out a better way of doing the above
> using map as well. Anyone?
Well, I wouldn't use map either:
sub lurch {
my $x = q/abcdefghijklmn/;
1 while $x =~ s/(.)(.)/$1\n$2/g;
return $x;
}
Or, let's get a bit fancier:
sub lurch {
my $x = q/abcdefghijklmn/;
$x =~ s/\B/\n/g;
return $x;
}
HTH,
Ala
------------------------------
Date: 27 Apr 1999 18:44:19 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: autoincrement magic a..z
Message-Id: <7g50i3$11t4$1@nntp6.u.washington.edu>
In article <MPG.118f6cf3a02d4a7698994b@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>[Posted and a courtesy copy sent.]
>
>In article <37255BFE.7A6D8B86@sgi.com> on Mon, 26 Apr 1999 23:41:02 -
>0700, Ben Gilbert <bgilbert@sgi.com> says...
>...
>> As to the second part of my question ... why doesn't it work in reverse?
>
>Well, what would the result of this be:
>
> my $x = 'b'; print --$x, --$x;
>
Or what would the result of this one be:
my $x= 'a0'; print --$x, ++$x;
I can think of 3 things right off, all of which would be considered
the wrong thing by somebody (and probably change depending on
circumstances).
>I'll bet that The Larry thought of that in designing this capability.
>:-)
and probably decided it wasn't worth the work to implement something
that wouldn't be used much and would be considered broken by a large
numbre of users reguardless of the implementation.
>
>--
>(Just Another Larry) Rosler
>Hewlett-Packard Company
>http://www.hpl.hp.com/personal/Larry_Rosler/
>lr@hpl.hp.com
--
-------------------------------------------------------------------------------
Gregory L. Snow | MATZ'S RULE REGARDING MEDICATIONS:
(Greg) | A drug is that substance which, when injected
snow@biostat.washington.edu | into a rat, will produce a scientific report.
------------------------------
Date: 27 Apr 1999 19:01:54 GMT
From: snow@biostat.washington.edu (Gregory Snow)
Subject: Re: autoincrement magic a..z
Message-Id: <7g51j2$14iu$1@nntp6.u.washington.edu>
In article <x7g15n9dxd.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
> >> length( $i ) == 1 && $i le 'z'
>
>as larry rosler said, the second part is redundant.
It is redundant for this particular example, but not for more general
cases (see below). I remeber reading somewhere that this is exactly
(well maybe not exactly, but close) what the .. operator uses.
> print 'a' .. 'z'
>
>which gets you what you did in a full loop. i suspect it stops by using
>an eq op but it is inclusive whereas $i eq 'z' in the for loop is
>exclusive! which tells us that if you want to write the loop with eq,
>you can't do the test in the for part, it has to be in the body:
>
> for ( $i = 'a' ; 1 ; $i++ ) {
>
> blah ;
>
> last if $i eq 'z' ;
> }
My simple tests indicate that the .. operator goes until there is
either a match with the second argument, or the length is greater than
the second argument. Try these simple command line tests:
perl -e "print join(' ','a'..'1').qq(\n);"
perl -e "print join(' ','a'..'10').qq(\n);"
The term magical fits well, It implies that something useful occurs,
but there is not a full structured logic (or algebra) that allows for
things like reversing the proccess or consistancy with other
opperations.
--
-------------------------------------------------------------------------------
Gregory L. Snow | MATZ'S RULE REGARDING MEDICATIONS:
(Greg) | A drug is that substance which, when injected
snow@biostat.washington.edu | into a rat, will produce a scientific report.
------------------------------
Date: Tue, 27 Apr 1999 18:48:38 GMT
From: wendy1967@my-dejanews.com
Subject: can not find the simple.pm
Message-Id: <7g50q4$8q5$1@nnrp1.dejanews.com>
Hello,
My system administrator installed perl 5.00556 in our UNIX. I tried to
use LWP::Simple but got this error message.
Could anybody help me with it?
Wendy
Content-type: text/html
<H1>Software error:</H1> <CODE>[Tue Apr 27 14:34:02 1999] Simple.pm: Can't
locate LWP/Simple.pm in @INC ( @INC contains:
/usr/local/lib/perl5/5.00556/sun4-solaris /usr/local/lib/perl5/5. 00556
/usr/local/lib/perl5/site_perl/5.00556/sun4-solaris /usr/local/lib/perl5/s
ite_perl/5.00556 .) at fetch.pl line 5. BEGIN failed--compilation aborted at
fetch.pl line 5. </CODE> <P>
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 27 Apr 1999 18:00:21 GMT
From: bing-du@tamu.edu
Subject: count associate array
Message-Id: <7g4tvi$69n$1@nnrp1.dejanews.com>
Hello there,
I know $#array+1 is the number of the elements of an array. Is there any
ready-to-use operator or function to tell the element number of an associative
array?
Thanks in advance for your help.
Bing
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Apr 1999 18:16:23 GMT
From: robobob@blech.mindwell.com (Jason)
Subject: Re: count associate array
Message-Id: <slrn7ibvnn.9dn.robobob@blech.mindwell.com>
On Tue, 27 Apr 1999 18:00:21 GMT, bing-du@tamu.edu <bing-du@tamu.edu> wrote:
>Hello there,
>
>I know $#array+1 is the number of the elements of an array. Is there any
>ready-to-use operator or function to tell the element number of an associative
>array?
>
$count = scalar(keys %hash);
--
Jason Kohles -- jason@mediabang.com
http://www.mediabang.com/
"This is as bad as it can get, but don't bet on it."
------------------------------
Date: Tue, 27 Apr 1999 16:40:47 -0400
From: Pierre-Luc <selectthree@gsig-net.qc.ca>
Subject: Re: Country of a visitor
Message-Id: <372620CE.22BB1D57@gsig-net.qc.ca>
Yes you're missing something!:-)
I don't want to ask; I want a counter to track it automatically.
Pierre-Luc Soucy
------------------------------
Date: Tue, 27 Apr 1999 13:02:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Eliminate elements from array with second array?
Message-Id: <MPG.118fb7aa84eabfb989953@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <x3yhfq2qda4.fsf@tigre.matrox.com> on Tue, 27 Apr 1999
11:44:03 -0400, Ala Qumsieh <aqumsieh@matrox.com> says...
> lou@visca.com writes:
>
> > My question concerns finding the best way to eliminate elements from
> > an array if they contain any of a list of strings from another
> > array.
>
> perldoc perlfaq4:
>
> How do I compute the difference of two arrays? How do I
> compute the intersection of two arrays?
Welcome, Ala. You are fourth (and last???) on the list of suckers. But
I'd like to think you are in good company. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 13:15:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ 6.5: How do I substitute case insensitively on the LHS, but preserving case on the RHS?
Message-Id: <MPG.118fbaa0d263d517989954@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <3725c99c@cs.colorado.edu> on 27 Apr 1999 08:28:44 -0700, Tom
Christiansen <perlfaq-suggestions@perl.com> says...
+ (This excerpt from perlfaq6 - Regexps
+ ($Revision: 1.26 $, $Date: 1999/04/14 03:46:19 $)
+ part of the standard set of documentation included with every
+ valid Perl distribution, like the one on your system.
+ See also http://language.perl.com/newdocs/pod/perlfaq6.html
+ if your negligent system adminstrator has been remiss in his duties.)
+
+ How do I substitute case insensitively on the LHS, but preserving
+ case on the RHS?
+
+ It depends on what you mean by "preserving case". The following
+ script makes the substitution have the same case, letter by
+ letter,
+ as the original. If the substitution has more characters than the
+ string being substituted, the case of the last character is used
+ for the rest of the substitution.
+
+ # Original by Nathan Torkington, massaged by Jeffrey Friedl
+ #
+ sub preserve_case($$)
+ {
+ my ($old, $new) = @_;
+ my ($state) = 0; # 0 = no change; 1 = lc; 2 = uc
+ my ($i, $oldlen, $newlen, $c) =
+ (0, length($old), length($new));
+ my ($len) = $oldlen < $newlen ? $oldlen : $newlen;
+
+ for ($i = 0; $i < $len; $i++) {
+ if ($c = substr($old, $i, 1), $c =~ /[\W\d_]/) {
+ $state = 0;
+ } elsif (lc $c eq $c) {
+ substr($new, $i, 1) = lc(substr($new, $i, 1));
+ $state = 1;
+ } else {
+ substr($new, $i, 1) = uc(substr($new, $i, 1));
+ $state = 2;
+ }
+ }
+ # finish up with any remaining new
+ (for when new is longer than old)
+ if ($newlen > $oldlen) {
+ if ($state == 1) {
+ substr($new, $oldlen) = lc(substr($new, $oldlen));
+ } elsif ($state == 2) {
+ substr($new, $oldlen) = uc(substr($new, $oldlen));
+ }
+ }
+ return $new;
+ }
+
+ $a = "this is a TEsT case";
+ $a =~ s/(test)/preserve_case($1, "success")/gie;
+ print "$a\n";
+
+ This prints:
+
+ this is a SUcCESS case
Well, fine. This is a nice C-ish program. But don't you think the FAQ
should also (or, dare I say, instead) present a Perl solution? How many
other examples in the FAQ show off Perl's magnificent bitwise ops
working on strings?
It relies on the property that the ASCII upper- and lower-case letters
differ by one bit. No locale-dependent claims are made.
Here it is as a regex:
#!/usr/local/bin/perl -w
use strict;
$_= "this is a TEsT case";
my $old = 'test';
my $new = 'success';
s/(\Q$old\E)/uc $new | (uc $1 ^ $1) .
(uc(substr $1, -1) ^ substr $1, -1) x
(length($new) - length $1)/egi;
print;
__END__
And here it is as a subroutine, modeled after the above:
sub preserve_case($$)
{
my ($old, $new) = @_;
my $mask = uc $old ^ $old;
uc $new | $mask .
substr($mask, -1) x (length($new) - length($old))
}
I don't claim originality for this solution. The idea was presented
here a while ago, but I haven't found it in DejaNews. I'm sure the
author will step forward to take credit.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 11:12:10 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: FAQ not applicable (was: Eliminate elements from array with second array?)
Message-Id: <MPG.118f9dd64f992ed3989951@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <3728e4d4.2113349@news.skynet.be> on Tue, 27 Apr 1999
16:32:59 GMT, Bart Lateur <bart.lateur@skynet.be> says...
> lou@visca.com wrote:
...
> >Andrew's code:
> >
> >my $re=join("|",@skips);
> >@found=grep(!m{/($re)/}o,@found);
> >
> >...was exactly what I was looking for:
>
> Only if you don't mind skipping things like "latest.html". (hint:
> "latest" =~ /test/)
>
> And you should take care to put backslashes in front of meta-characters.
Yes.
> My first idea is:
>
> my $re = join '|', map { quotemeta } @skip;
> @found = grep(!m{/\b($re)\b/}o,@found);
>
> but that doesn't work right if any of the alternatives starts of ends
> with a non-word char, and the associated "\b" should then be replaced
> with "\B" (put it inside the map() block).
No. The slashes in the regex act as literal delimiters of the
subdirectory name, not as delimiters of the regex (which is delimited by
{ and }). So no \b's are needed, and the regex in Andrew's code is OK.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 14:42:21 -0400
From: "Hiccup" <supton@soonet.ca>
Subject: Re: Free Web Hosting with CGI
Message-Id: <7g50h8$6hd$1@east42.supernews.com>
Yes there is one that has free a free cgi-bin...
www.virtaulave.net
I have a couple there myself, it's pretty good for a free site....
The Hicster
Pierre-Luc <selectthree@gsig-net.qc.ca> wrote in message
news:3724EAA5.95AA22E8@gsig-net.qc.ca...
>Yes there is one : Hypermart (http://www.hypermart.net).
>
>They give you 10MB, full CGI access, it's fast and free.
>
>The default is that you have to put a banner on each of your pages.
>
>Paul A. Fortin wrote:
>
>> Is there a site out there that allows CGI hosting and that is free.
>> I've tried "webjump" but they severely limit what you can do in a script
>> and it has become an irritant?
>>
>> Thanks for the help in advance.
>>
>> Paul A. Fortin
>
------------------------------
Date: Tue, 27 Apr 1999 20:31:18 GMT
From: homelessinseattle@my-dejanews.com
Subject: Re: Help Please! System commands from Win98 Perl CGI
Message-Id: <7g56qm$epi$1@nnrp1.dejanews.com>
> I do system("command > outputfile") and then look at the outputfile in a
> subsequent line or
> $output=`command`; and then look at the $output variable.
> My present experience is that this code seems not to want to execute
> either case.
I wish I was at my computer to test this for you, but I'm not- so I can
only give you a few hints from a little bit of what I know.
The first thing I would try is using a pipe, instead of an
output file.
open(PROGRAMHANDLE,"prog.exe |");
or:
@Programoutput=`prog.exe`; #<---backticks
Once you start a program like this, the program has to quit before
the perl script can continue. This might be avoidable if
you call a DOS batch-file from the script to do the dirty work for you.
Try making a dos batch with the perl commands that worked for you,
and call that from the script.
If the program doesn't quit by itself, try using the Win32::Spawn() method.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 27 Apr 1999 11:08:31 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: jeposner@my-dejanews.com
Subject: Re: how to read a huge file line by line without loading it into memory
Message-Id: <3725FD1F.19FC1C52@atrieva.com>
jeposner@my-dejanews.com wrote:
>
> I have two very large files (each greater than the amount of memory on my
> box) - I need to perform a two file match, but the only way I know in perl
> is to load the files up into memory with Open.
open() does not load the file into memory. It initializes a filehandle
and associates it with a file on disk. What you do with it after that
point will effect your memory usage.
> How can I read from each file one line at a time, or even better a block of N
> lines at a time?
while(<FILEHANDLE>){
# WooHoo!!
}
For all the exciting detail on I/O operators, open(), angle brackets,
and other file oriented functions, read the perlop and perlfunc
documents that came with your perl distribution.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: 27 Apr 1999 14:29:10 -0500
From: "steve" <losteven@yahoo.com>
Subject: How to use FTP in perl??
Message-Id: <372601f6@discussions>
Hi,
I would like to know how to FTP a file in perl?
What I need to do is that I need to use the FTP to transfer a file
to a website.
Thanks
--Posted from EarthWeb Discussions. http://discussions.earthweb.com
------------------------------
Date: Tue, 27 Apr 1999 13:33:15 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: How to use FTP in perl??
Message-Id: <ttnV2.12$GU3.1320@dfw-service1.ext.raytheon.com>
This has to be a FAQ. I think there's a module called Net::FTP, but you
might actually have to do some research to see if I'm right.
------------------------------
Date: Tue, 27 Apr 1999 19:44:46 +0100
From: "Wayne Keenan" <tripix@tdi-net.freeserve.co.uk>
Subject: Re: Monitoring the state of a serial port HELLLPPPPP
Message-Id: <7g52kf$j84$1@news7.svr.pol.co.uk>
use dejanews to hunt for serail port, I have posted a module that lets you set-up and use the serial port.
------------------------------
Date: Tue, 27 Apr 1999 16:27:52 -0700
From: "Scott Oseychik" <scott@simsbury.com>
Subject: newbie: Replace \n with <br>\n
Message-Id: <7g56tg$fu1@news.dns.microsoft.com>
I would like to pre-pend every newline character (\n) with <br>, so the
final result would be: <br>\n
Here's my code so far, but I can't seem to get it to work:
#!c:\perl\bin -w
print ("Type in a file name: ");
chomp($file = <STDIN>);
open(FILEHANDLE,"+<$file") || die "Can't find $file!!\n";
# for every newline character, replace it with
# <br>, then a newline character
while (<FILEHANDLE>)
{
$_ =~ s/\\n/<br>\\n/;
}
close(FILEHANDLE);
This script doesn't seem to do anything, but doesn't generate any errors,
either. Sorry if this is a dumb question...
--Scott
------------------------------
Date: Tue, 27 Apr 1999 13:38:20 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: On the fly conversion
Message-Id: <eynV2.13$GU3.1267@dfw-service1.ext.raytheon.com>
This has nothing to do with Perl. The experts here will flame you for a
post like this, and I don't particularly enjoy having to read it either.
------------------------------
Date: Tue, 27 Apr 1999 12:20:17 -0700
From: Jerome O'Neil <jeromeo@atrieva.com>
To: "Ashley M. Kirchner" <ashley@pcraft.com>
Subject: Re: On the fly conversion
Message-Id: <37260DF1.8C6D994B@atrieva.com>
Ashley M. Kirchner wrote:
> Anyone care to give me some pointers, or help me out here?
Visit your nearest CPAN mirror (or www.perl.com) and peruse the many
HTML:: modules used for parsing, changing, creating and other mangling
of HTML. You might want to pay close attention to the HTML::Parser
module, which will probably be of the most help.
For all the exciting detail on CPAN, modules and extending perl, read
the perlmod* documents that came with your perl distribution, or visit
www.perl.com, and select CPAN.
Good Luck!
--
Jerome O'Neil, Operations and Information Services
Atrieva Corporation, 600 University St., Ste. 911, Seattle, WA 98101
jeromeo@atrieva.com - Voice:206/749-2947
The Atrieva Service: Safe and Easy Online Backup http://www.atrieva.com
------------------------------
Date: Tue, 27 Apr 1999 15:04:26 -0400
From: C Anthony Bailey <bailey@le0102.pto.ford.com>
Subject: Out of memory
Message-Id: <37260A3A.F0951E0F@le0102.pto.ford.com>
Hello,
I am having a problem with a perl script that keeps running out of
memory. I can not figure out what is causing the memory to grow. I
have checked/limited most of the steps that (i thought) would force an
increase in memory, but no luck. Is there any way to print out how much
memory a script or variable is using? Either in the script itself of in
the debbuger? Thanks for any help
Tony
tbailey5@mail.ford.com
------------------------------
Date: Tue, 27 Apr 1999 13:19:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Output from eval
Message-Id: <MPG.118fbba593086d2c989955@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <xxx-2704991328220001@rose.cac.psu.edu> on Tue, 27 Apr 1999
13:28:22 -0400, Linda Littleton <xxx@psu.edu> says...
> When I run the following code (where eval is evaluating something with a
> syntax error), an error message is getting printed to the screen. What I
> want is to capture all of the messages so that I can then handle the
> situation in a different way. How do I keep eval from writing out this
> stuff?
>
> $calc = '5)8(';
> local ($ans) = eval $calc;
> print "Calc: $calc\n";
> print "Error: $@\n" if ($@);
> print "Answer: $ans\n";
Someone who respects others' time and attention would read the
documentation for 'eval()' before posting this question.
perldoc -f eval
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 27 Apr 1999 18:08:30 GMT
From: robobob@blech.mindwell.com (Jason)
Subject: Re: Perl->database problem
Message-Id: <slrn7ibv8u.96i.robobob@blech.mindwell.com>
On Tue, 27 Apr 1999 19:36:34 -0700, Ours <ours@casema.net> wrote:
>Hi,
>
>Does someone have a list of characters that cannot be sql-ed into an ACCESS
>database directly?
>I am trying to store some text into a memo-field but it seems to fail on the
>following for sure:
>',"!
>is there a way to "prepare" my $text so that it can be used as I want it. I
>definitly want to store caracters like this in the Memo-field.
>
If you are using the DBI interface, it includes a quote() function that
does just that:
$text = $dbh->quote($text);
--
Jason Kohles -- jason@mediabang.com
http://www.mediabang.com/
"This is as bad as it can get, but don't bet on it."
------------------------------
Date: Tue, 27 Apr 1999 13:30:03 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Perl->database problem
Message-Id: <uqnV2.11$GU3.1529@dfw-service1.ext.raytheon.com>
In Access SQL, a string literal like 'Tim's Answer' needs to be encrypted to
'Tim''s Answer'. Note: That is two single quotes, not a double-quote.
------------------------------
Date: Tue, 27 Apr 1999 16:16:09 -0400
From: Sushant Gargya <sushant@ntwrks.com>
Subject: PUZZLED: $query->popup_menu(......)
Message-Id: <37261B09.DCC707DB@ntwrks.com>
Hi 'yalls' ;-),
CGI/Perl Question for the enthusiasts.....
Following is a snip from my script.
+============Code Snip Begin==============+
$users = $query->popup_menu(-name=>'mID',
-values=>\@mList,
-labels=>\%mNames);
+========== Code Snip Ends================+
Where:
mList array contains things like: 0009,123,6554,...
mNames hash contains
keys: 0009,123,6554,...
values: "John","Jeff","Jack",.....
I would like to order/sort the popup_menu Labels with the sort criteria
as "values".
That is, I want to sort the hash mNames with the values of the hash. I
have tried
several things.....but now I must give up and ask for help.
PLEASE respond personally to sushant@ntwrks.com or sushant@vnet.net.
Regards,
-sushant
------------------------------
Date: Tue, 27 Apr 1999 13:52:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: PUZZLED: $query->popup_menu(......)
Message-Id: <MPG.118fc35910523963989956@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <37261B09.DCC707DB@ntwrks.com> on Tue, 27 Apr 1999 16:16:09 -
0400, Sushant Gargya <sushant@ntwrks.com> says...
> CGI/Perl Question for the enthusiasts.....
It is a Perl question. I don't see CGI anywhere. Which is good... :-)
> Following is a snip from my script.
> +============Code Snip Begin==============+
> $users = $query->popup_menu(-name=>'mID',
> -values=>\@mList,
> -labels=>\%mNames);
> +========== Code Snip Ends================+
> Where:
> mList array contains things like: 0009,123,6554,...
> mNames hash contains
> keys: 0009,123,6554,...
> values: "John","Jeff","Jack",.....
>
> I would like to order/sort the popup_menu Labels with the sort criteria
> as "values".
> That is, I want to sort the hash mNames with the values of the hash. I
> have tried
> several things.....but now I must give up and ask for help.
Have you tried reading the Perl FAQ? In particular perlfaq4: "How do I
sort a hash (optionally by value instead of key)?"
> PLEASE respond personally to sushant@ntwrks.com or sushant@vnet.net.
Sure, why not? No munged address, so OK.
By the way, next time set your newsreader^Wbrowser for a realistic line
wrap, say 72 characters, to avoid that noise above.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 27 Apr 1999 13:36:12 -0700
From: Rahul <rrahul@uswest.com>
Subject: ROUNDING A NUMBER IN PERL
Message-Id: <37261FBC.276B2261@uswest.com>
This is a multi-part message in MIME format.
--------------44C6518E9DF8811628B7CAC0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
How Do I round a number in perl?
--------------44C6518E9DF8811628B7CAC0
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Rahul Rastogi
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Rahul Rastogi
n: Rastogi;Rahul
org: TCS
email;internet: rrahul@uswest.com
note: Ph (W) 425-451-5225 , Ph(H) 425-373-1072
x-mozilla-cpt: ;0
x-mozilla-html: FALSE
version: 2.1
end: vcard
--------------44C6518E9DF8811628B7CAC0--
------------------------------
Date: Tue, 27 Apr 1999 11:51:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: searching perl documentation
Message-Id: <3726074A.4CAF62E@mail.cor.epa.gov>
Ed Bogart wrote:
> [snip opf prior posts]
> Let me jump in here and ask a question that has been bugging me. I
> started doing perl (SGI 02 running IRIX6.5 and version 5.004_04 built
> for IP19-irix) about a month ago and have been doing OK. However,
> perldoc doesn't seem to work the way it should. If I do 'perldoc -f
> BuiltinFunction' it's fine. If I do a 'perldoc -h' or the above 'perldoc
> perldoc' I get the help doc/pod whatever. When I try to get help with a
> 'PageName|ModuleName|ProgramName' I get the following (using the example
> from what perldoc -h returns.)
>
> physio% perldoc Term::Info
> No documentation found for "Term::Info".
> physio% perldoc Term/Info
> No documentation found for "Term/Info".
> physio% perldoc Term/Info
> No documentation found for "info".
perldoc Term::Info
That's the way to use it. But if your sysadmin [or you] hasn't
installed the module, you won't have any docs to be found. Try
using this on one of the modules that you know are installed on
your system. You have 5.004, so you should be able to get a
manpage with this:
perldoc Math::Trig
But you won't be able to use perldoc -q, a very useful option
for searching the FAQ. That's 5.005 . I'm using this as an
excuse to get the sysadmins to let me upgrade Perl on our Slowlaris
network. Hint, hint...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior Computing Specialist phone: (541) 754-4468
mathematical statistician fax: (541) 754-4716
------------------------------
Date: Tue, 27 Apr 1999 14:23:26 -0400
From: "Dave Kaufman" <davidk@nospam.cnct.com>
Subject: Re: stupid single quote " wipes out REST OF TEXT
Message-Id: <7g4vfu$qbq@world2.bellatlantic.net>
>> On Tue, 27 Apr 1999 05:53:30 -0400, tadmc@metronet.com (Tad McClellan)
wrote:
>> I am 5'10" tall and etc
>> there is only ONE quote in the text above,
>> this would be entered into a textfield, on a form, and then
>> if i feed that value into ANOTHER HIDDEN form field,
>> and try to pass it to another script the NEXT SCRIPT
>> drops everything AFTER THE SINGLE QUOTE when
>> it prints it to the browser???
you'll need to turn the " charcter into the " element before you can
embed it into a new html form. why? view the source of your form with this
text "hidden" and you'll see something like
<input type="hidden" value="I am 5'10" tall and etc">
which looks like: "I am 5'10" is the value and tall and etc look like
unknown empty attributes.
-dave
------------------------------
Date: Tue, 27 Apr 1999 15:10:02 -0400
From: "Charlie Schulz" <khschulz@yahoo.com>
Subject: Text Counter
Message-Id: <nYnV2.5$J7.1432@news.cetlink.net>
is it possible to have a texcounter looking at another page?
i want to have a counter.html looking to the inde.html file.
how can i do it?
thanks
------------------------------
Date: Tue, 27 Apr 1999 14:10:49 -0500
From: "Tim Armbruster" <t-armbruster@ti.com>
Subject: Re: Text Counter
Message-Id: <I0oV2.14$GU3.1552@dfw-service1.ext.raytheon.com>
This has nothing to do with Perl. The experts will flame you for posting
this, and I don't particularly enjoy having to read it either.
Charlie Schulz wrote in message ...
>is it possible to have a texcounter looking at another page?
>i want to have a counter.html looking to the inde.html file.
>
>how can i do it?
>
>thanks
>
>
------------------------------
Date: Tue, 27 Apr 1999 13:05:03 -0500
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <3725FC4F.85A29838@us.ibm.com>
renenyffenegger@my-dejanews.com wrote:
> So, I thought I'd be a good idea to go with
> $x = $y or "";
> Not so perl, saying: Useless use of constant in void context at....
>
> So what's wrong with that and how can I have a shorter version than
perldoc perlop
Take your pick:
$x = ($y or "");
$x = $y || "";
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: Tue, 27 Apr 1999 14:29:19 -0400
From: "Dave Kaufman" <davidk@nospam.cnct.com>
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <7g4vt4$s71@world2.bellatlantic.net>
>$x = $y or "";
>Not so perl, saying: Useless use of constant in void context at....
>
>So what's wrong with that and how can I have a shorter version than
>the hated
>$x = $y if defined $y;
>$x = "" unless defined $y;
try:
$x= $y || "";
the || operator binds more tightly than or does.
making
$x = $y or "";
evaluate as ($x = $y) or "";
whereas using || evaluates as $x = ($y or "");
hth,
-dave
------------------------------
Date: Tue, 27 Apr 1999 11:10:06 -0700
From: Aaron Rappaport <aaronr@spiritone.com>
Subject: Where find a2p?
Message-Id: <3725FD7E.A85A5791@spiritone.com>
Where can I find a2p for win95? I found some DOCUMENTATION for it ok at
CPAN, but no downloadable exe file.
Thanks
Aaron
------------------------------
Date: Tue, 27 Apr 1999 19:50:17 +0100
From: Dr Eberhard W Lisse <el@lisse.na>
Subject: Re: Win32, Word
Message-Id: <925239017.43123538@localhost>
Bob Daly <bdaly@averstar.com> wrote:
>I'm looking for example code for manipulating MS Word from
>a Perl script.....I want to insert captured form data (text file)
>into a Word document to generate it on the fly. =20
>
>Does anyone know if this is possible?
If they changed specifications at Microsnot daily, I would look at
RTF, perhaps?
el
--=20
Dr. Eberhard W. Lisse\ / Swakopmund State Hospita=
l
<el@lisse.NA> * | Resident Medical Office=
r
Private Bag 5004 \ / +264 81 1246733 (c) 64 461005(h) 461004(f=
)
Swakopmund, Namibia ;____/ Domain Coordinator for NA-DOM (el108=
)
------------------------------
Date: Tue, 27 Apr 1999 13:54:25 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: Bob Daly <bdaly@averstar.com>
Subject: Re: Win32, Word
Message-Id: <372607E1.764B5FD8@mail.uca.edu>
[cc'd to bd]
Bob Daly wrote:
>
> I'm looking for example code for manipulating MS Word from
> a Perl script.....I want to insert captured form data (text file)
> into a Word document to generate it on the fly.
>
> Does anyone know if this is possible?
Yes.
Oh, how? Use CGI and Win32::OLE. There are examples (using Excel) in the
docs, but there is quite a bit in the Perl-Win32-Users mailing list
archives at www.activestate.com which addresses working with Word
directly.
Cameron
--
Cameron Dorey
camerond@mail.uca.edu
------------------------------
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 5498
**************************************