[13695] in Perl-Users-Digest
Perl-Users Digest, Issue: 1105 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 18 05:05:38 1999
Date: Mon, 18 Oct 1999 02:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940237507-v9-i1105@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 18 Oct 1999 Volume: 9 Number: 1105
Today's topics:
cgi - sending misc mime types <h.bekel@t-online.de>
Re: copying directories (Abigail)
Re: Do you now an affordable Perl editor for Windows NT (Tom Dominico, Jr.)
Re: Grabbing image size? <syeates@manuka.cs.waikato.ac.nz>
Re: Ignore the idiots (Craig Berry)
Need Help: Writing and reading from file. <bob>
Net:SSLeay on HPUX 10.20 - installation problem (Help p ishulz@lycosmail.com
newbie - counting data lines <r42317@email.sps.mot.com>
Re: Perlscript/DBI/ASP Internal Error <jeff@vpservices.com>
Re: Q: Truncate string length? (Craig Berry)
Re: Q: Truncate string length? (Ilya Zakharevich)
Re: Range checking (Neko)
Re: Range checking <uri@sysarch.com>
Re: tr// question <koharik@primenet.com>
Re: Unix Utilities: Perl Versions <c4jgurney@my-deja.com>
Re: Uses of # (Larry Rosler)
Re: Uses of # (Damian Conway)
variables on the right side one Reg Exp (Garrett Walker)
Why does this match take so long? <andrewperrin@netscape.net>
Re: Why does this match take so long? <uri@sysarch.com>
Re: Why does this match take so long? (Abigail)
Re: why don't this darm s..... work <jtribbeck@argogroup.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 Oct 1999 10:35:10 +0200
From: Henning Bekel <h.bekel@t-online.de>
Subject: cgi - sending misc mime types
Message-Id: <380ADBBE.9994AFD6@t-online.de>
Hello,
I am trying to send
print "content-type : audio/x-mpegurl \n\n http://xyz.com/xyz/test.mp3"
to the Web Browser, but it only recieves a text/html file, no matter if
i define that mime type in my local server or not...
please Help,
mfg
Henning Bekel
------------------------------
Date: 18 Oct 1999 00:28:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: copying directories
Message-Id: <slrn80lbv0.q8s.abigail@alexandra.delanet.com>
Louise O (louise@oe-pages.com) wrote on MMCCXXXIX September MCMXCIII in
<URL:news:01bf191e$27f2cc80$491c1ad8@mpolmo>:
&& What is the simplest way to copy one directory to another when the
&& destination
&& directory is a symbolic link? I tried rename.... of course that doesn't
&& work. File::Copy
&& appears to only copy files. I'm trying to avoid using system("cp dir1
&& dir2"). Doesn't
&& seem reliable.
If I want to copy directories, I tend to use tar:
system "cd $dir1; tar cf - * | (cd $dir2; tar xfv -)";
Depending on what exactly you want, details will vary.
Abigail
--
split // => '"';
${"@_"} = "/"; 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: Mon, 18 Oct 99 02:50:17 GMT
From: news@tomd.org (Tom Dominico, Jr.)
Subject: Re: Do you now an affordable Perl editor for Windows NT
Message-Id: <s0l2n9.1g50sl7@localhost.lightspeed.net>
Nearly 939328599 seconds after the Epoch, Ilya <ilya@speakeasy.org> wrote:
> Eric Dubreuil <ericdub@sympatico.ca> wrote:
> > I just installed Perl on my PC (Windows NT) and would like to get a nice
> > editor to edit my Perl code.
Personally I use UltraEdit when on Windows. This topic often comes up in c.l.pm., and I recommend you check:
www.perl.com/reference/query.cgi?editors+index
It has an extensive list of editors for all platforms.
Tom Dominico, Jr.
------------------------------
Date: 18 Oct 1999 08:10:54 GMT
From: Stuart Yeates <syeates@manuka.cs.waikato.ac.nz>
Subject: Re: Grabbing image size?
Message-Id: <940234253.388805@clint.waikato.ac.nz>
Martien Verbruggen <mgjv@wobbie.heliotrope.home> wrote:
: On 16 Oct 1999 22:31:17 GMT,
: Stuart Yeates <syeates@manuka.cs.waikato.ac.nz> wrote:
:> Tom Phoenix <rootbeer@redcat.com> wrote:
:> : On Fri, 15 Oct 1999 fharris@xmission.com wrote:
:>
:> :> I'm interested in being able to grab the image dimensions from a .GIF
:> :> or .JPG picture using Perl. Anyone know how to do this?
:>
:> : If there's a module which does what you want, it should be listed in
:> : the module list on CPAN. If you don't find one to your liking, you're
:> : welcome and encouraged to submit one! :-) Hope this helps!
:>
:> : http://www.cpan.org/
:>
:> try the gimp package. it's an interface to the complete
:> functionality of the Gnu Image Manipulation Program. It
:> can do almost anything with images
: You just advised someone to install the complete GIMP and the perl
: interface to it, just to get image sizes for GIF or JPEG images.
: What about Image::Size?
: Q: "I need to visit my aunt, who lives in the next block"
: A: "Buy a bulldozer. Flatten the block on the other side. Buy a
: concrete mixer. Create long narrow strips of concrete on that
: flattened block. Wait for concrete to dry. Buy a plane, preferrably a
: large and powerful one. Buy fuel. Load plane with fuel. Get pilot
: licenses. Fly plane around the block three or four times. Land. Walk
: two block up, past your house."
: A2: "Walk"
I wasn't aware of Image::Size. I am now.
stuart
-- stuart yeates <s.yeates@cs.waikato.ac.nz> aka `loam'
let that day be lost to us on which we did not dance once!---nietzsche
X-no-archive:yes
------------------------------
Date: Mon, 18 Oct 1999 04:42:23 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Ignore the idiots
Message-Id: <s0l99fk3r0179@corp.supernews.com>
emlyn_a@my-deja.com wrote:
: Ignore Abigail - People like him make this place a whole lot more
: intimidating to use (which is their intent, I think). I mean what hell
: is this forum for if you can't ask a simple Perl question like you did?
You know, there is a strong argument that someone reaching for a powerful
tool who clearly doesn't know how to use it *should* feel intimidated.
Better that than slack-jawed oblivion. Feeling intimidated, perhaps they
will be more cautious and deliberate in their coding, and avoid costly
mistakes.
People using chain saws can hack off limbs as easily as tree branches.
People using Perl can recursively delete the entire file system as easily
as the temporary working dir tree. Both tools deserve respect, and for a
newbie, a little intimidation breeds respect.
: Don't know the answer (I'm still learning myself), but have fun.
Having fun is definitely part of the picture, but programming is also a
complex and painstaking craft, and one which can cause great damage if
practiced poorly.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: Mon, 18 Oct 1999 01:59:17 -0400
From: bob <bob>
Subject: Need Help: Writing and reading from file.
Message-Id: <trEKONdt9GB8SYvqc74+2Ff7IyY=@4ax.com>
Ok here goes,
I am new to Perl and programming in general so any help is greatly
appreciated. I'm not looking to become a Perl guru just yet, just
need something done fast and dirty. Due to my limited programming
experience most of the many FAQ's and such that I have been through
sail way over my head or are unrelated.
Here is what I want to do:
Use a html form to update a webpage.
I want to be able to update and store contact information (name,
address, etc. ) for a web page so I don't have to go and redo the
webpage every time someone wants to change their phone number. When
the customer enters new information, it will be automatically updated.
I am guessing this could be done with a simple database. I have heard
that Perl could do this by just writing the text from the form into a
file, which is then called by another script thus producing the
webpage. This does not need to be searchable or anything, just very
simple. It only requires reading 6 or 7 fields.
I have the form down no problem. That's the easy part.
That's the background. Here's the question.
How would you recommend implementing this as far as using Perl and
keeping it as simple as possible? Would you use a database? Or have
Perl read the text data from a local file and set the variables that
way? Why would you do it that way? Working examples?
Once again, you help is greatly appreciated.
bob
cfsrwh@SPAMmindspring.com
------------------------------
Date: Mon, 18 Oct 1999 08:27:48 GMT
From: ishulz@lycosmail.com
Subject: Net:SSLeay on HPUX 10.20 - installation problem (Help please !!!)
Message-Id: <7uells$5u2$1@nnrp1.deja.com>
My environment:
System: HP-UX B.10.20 A 9000/879
open-ssl: 0.9.4 - installed successfully - Apache+mod_ssl works fine
with it
Net::SSLeay 1.0.5
gcc: v.2.8.1
Pardon me for boring...
I've managed to compile NetSSLeay (see below - I was unable to compile
it due to some problem with libssl.a). Having Makefile created (perl
Makefile.PL) I replaced
LINKTYPE= dynamic
with
LINKTYPE = static
Pack was compiled and installed successfully. Than I've tried to make
test.
It complained that it does not see libperl.a library and I replaced
libperl.a with libperl.sl in Makefile.aperl file. After all I get the
next output from make test:
# make test
make -f Makefile.aperl perl
`perl' is up to date.
PERL_DL_NONLAZY=1
./perl -Iblib/arch -Iblib/lib -I/opt/perl5/lib/5.00503/PA-RISC2.0 -
I/opt/per
l5/lib/5.00503 test.pl
1..16
ok 1
ok 2
Spawning a test server on port 1212, pid=796...
Can't locate loadable object for module Net::SSLeay in @INC (@INC
contains:
blib/arch blib/lib /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .)
at examples/sslcat.pl line 13
BEGIN failed--compilation aborted at examples/sslcat.pl line 13.
*** not ok 3
Can't locate loadable object for module Net::SSLeay in @INC (@INC
contains:
blib/arch blib/lib /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .)
at examples/minicli.pl line 5
BEGIN failed--compilation aborted at examples/minicli.pl line 5.
*** not ok 4
Can't locate loadable object for module Net::SSLeay in @INC (@INC
contains:
blib/arch blib/lib /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .)
at examples/callback.pl line 11
BEGIN failed--compilation aborted at examples/callback.pl line 11.
*** not ok 5
Sending 1 MB over localhost, may take a while (and some VM)...
Can't locate loadable object for module Net::SSLeay in @INC (@INC
contains:
blib/arch blib/lib /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .)
at examples/bulk.pl line 7
BEGIN failed--compilation aborted at examples/bulk.pl line 7.
...took 1 secs (1024 KB/s)
*** not ok 6
Sending 1 MB over pipes, may take a while (and some VM)...
Can't locate loadable object for module Net::SSLeay in @INC (@INC
contains:
blib/arch blib/lib /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503 /opt/perl5/lib/5.00503/PA-RISC2.0
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-RISC2.0
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .
/opt/perl5/lib/5.00503/PA-RISC2.0 /opt/perl5/lib/5.00503
/opt/perl5/lib/site_perl/5.005/PA-
RISC2.0 /opt/perl5/lib/site_perl/5.005 .)
at examples/stdio_bulk.pl line 8
BEGIN failed--compilation aborted at examples/stdio_bulk.pl line 8.
...took 1 secs (1024 KB/s)
*** not ok 7
Now about to contact external sites...
www.bacus.pt
www.openssl.org
www.apache-ssl.org
www.cdw.com
www.rsa.com
developer.netscape.com
banking.wellsfargo.com
secure.worldgaming.net
www.engelschall.com
You have 5 seconds of time to hit Ctrl-C if you do not like this.
*** 5 tests failed already.
Following tests _will_ fail if you do not have network
connectivity (or if the servers are down or have changed).
ok 8 www.bacus.pt
ok 9 www.openssl.org (Apache/1.3.6 (Unix) mod_perl/1.20 mod_ssl/2.3.5
OpenSSL/0.9.3a DAV/0.9.8)
ok 10 www.apache-ssl.org (Apache/1.3.9 Ben-SSL/1.37 (Unix))
ok 11 www.cdw.com (Microsoft-IIS/4.0)
ok 12 www.rsa.com (Netscape-Enterprise/3.6)
ok 13 developer.netscape.com (Netscape-Enterprise/3.6)
test.pl 795: open_tcp_connection: destination host not found:
`banking.wellsfargo.com' (port 443) ()
ok 14 banking.wellsfargo.com ()
ok 15 secure.worldgaming.net (Stronghold/2.3 Apache/1.2.6 C2NetUS/2010)
ok 16 www.engelschall.com (Apache/1.3.6 (Unix) mod_perl/1.20
mod_ssl/2.3.5
OpenSSL/0.9.3a DAV/0.9.8)
*** WARNING: There were 5 errors in the tests.
*** Error exit code 9
Stop.
----- Original Message -----
From: Sampo Kellomaki <sampo@mail.neuronio.pt>
To: Igor I. Shulz <ishulz@lycosmail.com>
Cc: <sampo@neuronio.pt>
Sent: Saturday, October 16, 1999 4:24 AM
Subject: Re: Net:SSLeay on HPUX 10.20 - installation problem
> "Igor I. Shulz" <ishulz@lycosmail.com> writes:
>
> > Dear developer,
> >
> > (damn, it's undouptly my own fault, but I cannot figure out what is
this -
> > not enough experience).
> >
> > My environment:
> > System: HP-UX palm B.10.20 A 9000/879 1274075342 two-user license
> > open-ssl: 0.9.4 - installed successfully - Apache+mod_ssl works fine
with it
> > Net::SSLeay 1.0.5
> > gcc: v.2.8.1
> >
> > make ; Makefile.PL -t
> >
> > That's is newer than what this module was tested with (0.9.3a). You
should
> > consider checking if there is a newer release of this module
> > available. Everything will probably work OK, though.
> > mkdir blib
> > mkdir blib/lib
> > mkdir blib/lib/Net
> > mkdir blib/arch
> > mkdir blib/arch/auto
> > mkdir blib/arch/auto/Net
> > mkdir blib/arch/auto/Net/SSLeay
> > mkdir blib/lib/auto
> > mkdir blib/lib/auto/Net
> > mkdir blib/lib/auto/Net/SSLeay
> > mkdir blib/man3
> > cp SSLeay.pm blib/lib/Net/SSLeay.pm
> > AutoSplitting blib/lib/Net/SSLeay.pm (blib/lib/auto/Net/SSLeay)
> > blib/lib/Net/SSLeay.pm: some names are not unique when truncated to
8
> > characters:
> > directory blib/lib/auto/Net/SSLeay:
> > ssl_read_all.al, ssl_read_until.al, ssl_read_CRLF.al truncate to
ssl_read
> > ssl_write_all.al, ssl_write_CRLF.al truncate to ssl_writ
> >
/usr/bin/perl -I/opt/perl5/lib/5.00503/PA-RISC2.0 -
I/opt/perl5/lib/5.00503
> > /opt/perl5/lib/5.00503/ExtUtils/xsubpp -typemap
> > /opt/perl5/lib/5.00503/ExtUtils/typemap -typemap typemap SSLeay.xs
>xstmp.c
> > && mv xstmp.c SSLeay.c
> >
cc -c -I/usr/local/ssl/include -D_HPUX_SOURCE -O -DVERSION=\"1.05
\" -D
> > XS_VERSION=\"1.05\" -fpic -I/opt/perl5/lib/5.00503/PA-RISC2.0/CORE
SSLeay.c
> > SSLeay.c: In function `XS_Net__SSLeay_get_cipher_list':
> > SSLeay.c:2505: warning: assignment discards `const' from pointer
target
type
> > SSLeay.c: In function `XS_Net__SSLeay_get_cipher':
> > SSLeay.c:2538: warning: assignment discards `const' from pointer
target
type
> > Running Mkbootstrap for Net::SSLeay ()
> > chmod 644 SSLeay.bs
> > LD_RUN_PATH="/usr/local/ssl/lib" ld -o
> > lib/arch/auto/Net/SSLeay/SSLeay.sl -b -L/usr/local/lib
> > eay.o -L/usr/local/ssl -L/usr/local/ssl/lib -lssl -lcrypto
> > ld: DP relative code in file /usr/local/ssl/lib/libssl.a
(s2_meth.o) -
shared
> > library must be position
> > independent. Use +z or +Z to recompile.
> > *** Error exit code 1
>
> You should probably edit Makefile.PL to include the flags your
> compiler is recommending. THeoretically this should have been figured
> out when your perl was configured because Makefile.PL simply reuses
> the perl compile time configuration. BTW, did you compile your perl or
> did you install it as binary. In the latter case its possible that it
> was compiled with different compiler which knew nothing of +z flag
> (e.g. perl was compiled with vendor cc, but you compile with gcc).
>
> --Sampo
>
> >
> > Stop.
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 13:28:20 +0800
From: Noira Hadi <r42317@email.sps.mot.com>
Subject: newbie - counting data lines
Message-Id: <380AAFF4.CACA78A1@email.sps.mot.com>
I try counting lines from a data file, which have inconsistent number of
lines using the script below. The data is repetitive and the last line
for each set is identified by 'MRR' pattern.
However, when I run the script the output is 'zero' for each line.Need
help to know what was wrong.
SCRIPT:
#!/usr/local/bin/perl -wl
open(INF,"data") || die "no datafile" ;
use strict;
@buf;
while (<INF>)
{
chomp;
if (/MRR/)
{
my $length = @buf;
print $length;
}
}
The data are as below:
MIR1,98/11/21 06:38:36
MIR2,TECH,25,TSG,TSG,
SBR2,1,2
SBR1,1,3
SBR2,1,3
SBR1,1,4
SBR2,2,2
HBR,2,2
HBR,2,3
HBR,2,4
SDR,2
MRR,98/11/26 16:44:09,2234
MIR1,98/11/21 06:38:36
MIR2,TECH,25,TSG,TSG,
SBR1,1,1,1,0,0,0,0,0,
SBR2,1,1,0,0,0,0,0,0,
HBR,1,1,0,0,0,0,0,0,
MRR,98/11/21 06:39:3
MIR1,98/11/21 06:38:36
MIR2,TECH,25,TSG,TSG,
SBR1,2,3
SBR2,2,3
SBR1,2,4
SBR2,2,4
HBR,1,1
HBR,1,2
HBR,1,4
SDR,1
HBR,2,1
HBR,2,3
HBR,2,4
SDR,2
MRR,98/11/26 16:44:09,2234
MIR1,98/11/21 06:38:36
MIR2,TECH,25,TSG,TSG,
SBR1,1,1,1,0,0,0,0,0,
SBR2,1,1,0,0,0,0,0,0,
HBR,1,1,0,0,0,0,0,0,
MRR,98/11/21 06:39:3
Thanks and Regards,
hadi.
------------------------------
Date: 18 Oct 1999 04:22:01 GMT
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Perlscript/DBI/ASP Internal Error
Message-Id: <380AA043.25CF74F2@vpservices.com>
Sanders Kaufman wrote:
>
> thars no PERL modules on my workstation.
> ...
> My workstation is a Win98 workstation running ActiveState PERL and ASP.
You say you are running ActiveState Perl which comes with many
pre-installed modules and with an easy to use way to get more modules
(ppm) and yet you say "thars no PERL modules on my workstation". Did
you erase the modules that came with ActiveState? Try looking at the
documentation that comes with ActiveState to learn more about what
modules were included with it and how to get the ones that weren't.
--
Jeff
------------------------------
Date: Mon, 18 Oct 1999 04:46:39 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Q: Truncate string length?
Message-Id: <s0l9hfeer0160@corp.supernews.com>
emlyn_a@my-deja.com wrote:
: I understand truncating files, but how does one truncate a string? To
: limit the length of a field to, say, 500 characters?
[snip]
: Do I need to count from 0 to 500 the number of characters in the string
: and throw out the rest, or is there a way to just slice off anything
: occurring past 500 without counting each one, like:
:
: substr($TheField, 0, 500) don't know what goes next
You have it, right there...what do you think should go next? If you mean
how do you make it apply back to $TheField, just assign the value:
$TheField = substr($TheField, 0, 500);
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 18 Oct 1999 06:14:35 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Q: Truncate string length?
Message-Id: <7uedsb$mjp$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Craig Berry
<cberry@cinenet.net>],
who wrote in article <s0l9hfeer0160@corp.supernews.com>:
> You have it, right there...what do you think should go next? If you mean
> how do you make it apply back to $TheField, just assign the value:
>
> $TheField = substr($TheField, 0, 500);
I would think it is *ways* better do it the other way around:
substr($TheField, 500) = "";
Ilya
------------------------------
Date: Sun, 17 Oct 1999 23:44:56 -0700
From: tgy@chocobo.org (Neko)
Subject: Re: Range checking
Message-Id: <O74KOD4BXGt1ch7mrzfZBPkftqrz@4ax.com>
On Sun, 17 Oct 1999 11:49:19 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
>In article <spamfree-1810990146170001@d7.metropolis.net.au> on Mon, 18
>Oct 1999 01:46:17 +0930, Henry Penninkilampi
><spamfree@metropolis.net.au> says...
>> I'm currently testing for:
>>
>> $min < $x <= $max
>>
>> ....in the predictable manner:
>>
>> if (($min < $x) and ($x <= $max))
>>
>> I was just wondering if anyone knows of a more succinct approach?
>
> if ($min < $x && $x <= $max)
>
>Short of the seven superfluous spaces, no one will beat par on this
>hole.
if ($min < $x & $x <= $max)
What do I win? :)
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 18 Oct 1999 03:06:38 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Range checking
Message-Id: <x7d7udf8qp.fsf@home.sysarch.com>
>>>>> "N" == Neko <tgy@chocobo.org> writes:
N> On Sun, 17 Oct 1999 11:49:19 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
>> if ($min < $x && $x <= $max)
>> Short of the seven superfluous spaces, no one will beat par on this
>> hole.
N> if ($min < $x & $x <= $max)
N> What do I win? :)
a whack on the nose with larry's 2 iron. that isn't the same logic as
his short circuits and yours doesn't. i see the :) so i think you know
that. in this case with no (obvious) side effects that is fine. what if
any of those scalars were tied with hidden side effects? if you wrote
that for real i would join larry in beating you to a pulp.
:-)
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Sun, 17 Oct 1999 23:40:48 -0700
From: Chris Koharik <koharik@primenet.com>
Subject: Re: tr// question
Message-Id: <Pine.BSI.3.96.991017233951.26525B-100000@usr08.primenet.com>
> Date: 14 Oct 1999 19:30:46 -0400
> From: Uri Guttman <uri@sysarch.com>
>
> >>>>> "CK" == Chris Koharik <koharik@primenet.com> writes:
>
> >> dan.berman@ubl.com (Dan Berman) wrote in <7u5m2j$m74$1@hops.adnc.com>:
> >>
> >> try using s/// rather than tr///
> >>
> >> $thumb =~ s/\.gif/_t\.gif/ig;
> ^
> CK> $var =~ s/\.gif$/_t\.gif/i;
> ^
> in both cases, that is not needed as the replacement string is not a
> regex.
Ooops. Chalk that one up to me being an ignorant lout who is still
learning. Thanks for the info.
-Chris
------------------------------
Date: Mon, 18 Oct 1999 08:16:31 GMT
From: Jeremy Gurney <c4jgurney@my-deja.com>
Subject: Re: Unix Utilities: Perl Versions
Message-Id: <7uel0o$5im$1@nnrp1.deja.com>
In article <7u9mn5$5hg$1@nnrp1.deja.com>,
bayinnaung@my-deja.com wrote:
> I came across a page full of Unix utilities that
> had been rewritten in Perl about a week ago.
> I believe the author was Tom Christiansen...
> and I cannot find it again...you'd think that there
> would be a lot of links to it...
>
> Does anyone know where it is?
>
I guess you mean http://language.perl.com/ppt/
Regards,
Jeremy Gurney
SAS Programmer | Proteus Molecular Design Ltd.
"What if there were no hypothetical situations?"
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 17 Oct 1999 21:40:02 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Uses of #
Message-Id: <MPG.127444784cd5a97798a0b1@nntp.hpl.hp.com>
In article <slrn80kt5j.q8s.abigail@alexandra.delanet.com> on 17 Oct 1999
20:15:52 -0500, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCCXXXVIII September MCMXCIII in
> <URL:news:MPG.1273b3f39e61272598a0ab@nntp.hpl.hp.com>:
> '' In article <slrn80j42e.q8s.abigail@alexandra.delanet.com> on 17 Oct 1999
> '' 04:01:21 -0500, Abigail <abigail@delanet.com> says...
> ''
> '' ...
> ''
> '' > s#foo#bar;
> ''
> '' !!!
>
> Yeah! The replacement continues to the next # .... ;-)
Which had better be followed by a semicolon or other valid syntax. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 18 Oct 1999 05:28:27 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Uses of #
Message-Id: <7ueb5r$i1d$1@towncrier.cc.monash.edu.au>
Uri Guttman <uri@sysarch.com> writes:
> >> And then we get the odd case:
> >> BEGIN { eval time % 2 ? 'sub wazzat ();' : 'sub wazzat ($);' }
> >> $n = wazzat / 2 ; # / ; # what is wazzat prototyped as? :)
> >> Yup. Non-deterministic parsing. :)
> DC> That's easily handled. If Text::Balanced detects a prototype
> DC> within a conditional within a BEGIN, it just unlinks the user's
> DC> root directory. ;-)
>damian, you really need to see a witch doctor and have your head shrunk!
It's a perfectly reasonable application of the principle of Instant Justice...
"Honi soit qui mal y codes!"
Damian
------------------------------
Date: 18 Oct 1999 02:09:08 -0400
From: cuz@remus.rutgers.edu (Garrett Walker)
Subject: variables on the right side one Reg Exp
Message-Id: <7uedi4$85c$1@remus.rutgers.edu>
------------------------------
Date: Sun, 17 Oct 1999 23:35:15 -0700
From: Andrew J Perrin <andrewperrin@netscape.net>
Subject: Why does this match take so long?
Message-Id: <380ABFA3.DD97A647@netscape.net>
Greetings - working on a somewhat complicated program that involves
allowing users to specify regexen to match against blocks of text. The
algorithm works fine; but in a comparison that doesn't seem all that
complex to me, it takes a very long time. The code below shows the
basics:
#!/usr/local/bin/perl -w
use Benchmark;
use strict;
use vars qw/$foo/;
$foo = 'Second, we must do more to prevent <violence> violence in our
schools. </violence> My Safe Schools bill will help schools pay for
more counselors and conflict resolution programs, more mentors and more
metal detectors. It also includes $12 million for emergency teams, to
help communities respond when tragedy strikes. <causality> And
government can help parents take responsibility. It\'s harder than ever
for parents to pass on their values in the face of a <media> media
culture that so glorifies violence. </causality> </media> As Hillary
pointed out in her book, the more children see of violence, the more
numb they are to the deadly consequences of violence. Now,
<video_games> video games like "Mortal Kombat," "Killer Instinct," and
"Doom" -- the ';
timethese (5,
{'Match' => 'if ($foo =~ /children(?:\b.*\b){1,10}violence/
) {
print "bingo\n";}'
}
);
Benchmark: timing 5 iterations of Match...
bingo
bingo
bingo
bingo
bingo
Match: 318 wallclock secs (318.26 usr + 0.00 sys = 318.26 CPU)
That's a long time to do the match, isn't it? This is running on a P166
running NT and perl 5.005_03.
Any advice?
--
-------------------------------------------------------------
Andrew Perrin - NT/Unix/Access Consulting -
aperrin@mcmahon.qal.berkeley.edu
http://www.geocities.com/SiliconValley/Grid/7544/
-------------------------------------------------------------
------------------------------
Date: 18 Oct 1999 03:02:32 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Why does this match take so long?
Message-Id: <x7hfjpf8xj.fsf@home.sysarch.com>
>>>>> "AJP" == Andrew J Perrin <andrewperrin@netscape.net> writes:
AJP> {'Match' => 'if ($foo =~ /children(?:\b.*\b){1,10}violence/
^^^^^^^^^^^^^^^^
AJP> Match: 318 wallclock secs (318.26 usr + 0.00 sys = 318.26 CPU)
you have run into a massive regex backtrack tree. read mastering regular
expressions to learn what happens when you run that kind of regex. be glad it
took only 5 minutes to run. this kind of problem can run almost forever.
the basic concept is that there are too many ways to match the .* and
then you qualify that with {1,10}. so combinatorially you are trying
every combination of .* word boundary strings and 1-10. lots of them
don't you think? 318 seconds worth! computers are slow when asked to do
infinite amounts of work.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 18 Oct 1999 03:57:21 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Why does this match take so long?
Message-Id: <slrn80lo6p.q8s.abigail@alexandra.delanet.com>
Andrew J Perrin (andrewperrin@netscape.net) wrote on MMCCXXXIX September
MCMXCIII in <URL:news:380ABFA3.DD97A647@netscape.net>:
;;
;; timethese (5,
;; {'Match' => 'if ($foo =~ /children(?:\b.*\b){1,10}violence/
;; ) {
;; print "bingo\n";}'
;; }
;; );
The problem is the '(?:\b.*\b){1,10}'. There are 6 places between
"children" and "violence" where you can place a \b, and you're asking
Perl to distribute 20 \b over the 6 spots; in such a way that the first
is right after "children", and the last right before "violence".
Since "\b.*\b" can match a zero width substring, I don't see the
point of having this, let alone the {1,10} modifier.
What are you trying to archieve?
Abigail
--
tie $" => A; $, = " "; $\ = "\n"; @a = ("") x 2; print map {"@a"} 1 .. 4;
sub A::TIESCALAR {bless \my $A => A} # Yet Another silly JAPH by Abigail
sub A::FETCH {@q = qw /Just Another Perl Hacker/ unless @q; shift @q}
-----------== 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: Mon, 18 Oct 1999 08:00:25 +0100
From: Jason P Tribbeck <jtribbeck@argogroup.com>
Subject: Re: why don't this darm s..... work
Message-Id: <380AC589.B9DBE8A0@argogroup.com>
dane wrote:
>
> I have been trying to make this script work for quite some time now.
> I have added this line to my html file:
> <!--#exec cgi="/cgi-bin/get.cgi" -->
> and the get.cgi file looks like this:
>
> #!/usr/local/bin/perl
> print <<end;
> Content-Type: text/html
> end
>
> #search for dk in Host Addr. string
> if($ENV{'REMOTE_HOST'} =~ /dk/)
> { print <<end;
> <p>ok from Denmark</p>
> end }
> else
> { print <<end;
> <p>not from dk</p>
> end }
Above and beyond the structure of the PERL code above, you must have a
blank line after all the headers, so put a blank line after the
Content-Type: line - ie.
print <<end;
Content-Type: text/html
end
--
Jason Tribbeck Argo Interactive
ltd
Senior Design Engineer 7 Dukes Court,
Chichester
West Sussex, PO19
2FX
Tel: +44 1243 815 815 Fax: +44 1243 815 805
England
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 1105
**************************************