[11179] in Perl-Users-Digest
Perl-Users Digest, Issue: 4779 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jan 29 13:07:21 1999
Date: Fri, 29 Jan 99 10:00:24 -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, 29 Jan 1999 Volume: 8 Number: 4779
Today's topics:
Re: A known problem ??? <marms@sandia.gov>
a2p utility broken? bhoylma@uswest.com
Re: Changing sort order on the fly... (Randal L. Schwartz)
Re: Finding/Printing system uptime in perl (Greg Ward)
Re: Getting the last number in an IP addr with a regex. (Steve Alpert)
Re: Good CGI Book (Sam Curren)
Re: Help on deleting an item in an array? <c-denman@dircon.co.uk>
Re: Help on deleting an item in an array? <uri@home.sysarch.com>
Re: Help on deleting an item in an array? <jdf@pobox.com>
Help with simple Perl problem. (David Salvador Flores)
Re: How to use GDBM (Novice) (Sam Curren)
Re: installing perl (Greg Ward)
Re: Learning perl <eric.gorely@mci.com>
Re: Limiting length of datasent from a text box <jdf@pobox.com>
Re: LWP and multiple connections at the same time <zozulak@point.sk>
Re: NTFS directory traversal <jdf@pobox.com>
Re: ok please don't shoot me for this question <uri@home.sysarch.com>
Omaha Perl Mongers Meeting ptimmins@netserv.unmc.edu
outputting perl errors as html? <c-denman@dircon.co.uk>
Re: outputting perl errors as html? <c-denman@dircon.co.uk>
Re: outputting perl errors as html? <jeromeo@atrieva.com>
Re: Perl 4.0 Question (Andrew M. Langmead)
Perl 5.002 on AIX ---> Perl 5.0x on MkLinux (Problems) <eric.a.sager@boeing.com>
perl module for zipping? <eedalf@eed.ericsson.se>
Perl programmers needed in London <studio@inta.net.uk>
Print OUT korn shell syntax in Perl script? <biwillia@cisco.com>
Re: Print OUT korn shell syntax in Perl script? <tbriles@austin.ibm.com>
Re: reading binary files <ludlow@us.ibm.com>
Re: regex lib or Perl linked in? (Greg Ward)
Re: Regexp matching (Randal L. Schwartz)
SED command in PERL through HTML smanand@my-dejanews.com
Re: Stopping a foreach loop droby@copyright.com
Re: Stopping a foreach loop (M.J.T. Guy)
strange behaviour with tr/// tommy927@my-dejanews.com
Re: strange behaviour with tr/// <uri@home.sysarch.com>
Re: Sybperl - Specifying the interface file <mpeppler@mbay.net>
Re: system 'stty', '-echo' on Win32??? <qdtrini@jdicms88.ericsson.se>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Jan 1999 09:28:05 -0700
From: Mike Arms <marms@sandia.gov>
To: tristan.braun@pneu.com
Subject: Re: A known problem ???
Message-Id: <36B1E195.74253E2A@sandia.gov>
This is a multi-part message in MIME format.
--------------C27B8375D1D0A89DFC4FC145
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Tristan Braun wrote:
> I am using Version 5.003_07 for Win32. My Problem is, when I am
> using the format function combined with write, I get no result.
I strongly suggest that you update to perl 5.005_02 .
Go to www.ActiveState.com and get the latest version of
ActivePerl (currently 509). This is the de-facto standard
win-32 perl these days.
--
Mike Arms
marms@sandia.gov
What is the sound of Perl? Is it not the sound of a wall that
people have stopped banging their heads against?" --lwall
--------------C27B8375D1D0A89DFC4FC145
Content-Type: text/x-vcard; charset=us-ascii; name="vcard.vcf"
Content-Transfer-Encoding: 7bit
Content-Description: Card for Mike Arms
Content-Disposition: attachment; filename="vcard.vcf"
begin: vcard
fn: Mike Arms
n: Arms;Mike
org: Sandia National Laboratories
adr;dom: P.O. Box 5800;;M.S. 1138;Albuquerque;NM;87185;
email;internet: marms@sandia.gov
tel;work: 505-844-3051
tel;fax: 505-284-3850
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
--------------C27B8375D1D0A89DFC4FC145--
------------------------------
Date: Fri, 29 Jan 1999 16:52:20 GMT
From: bhoylma@uswest.com
Subject: a2p utility broken?
Message-Id: <78sovv$p6k$1@nnrp1.dejanews.com>
Ciao!
It was just brought to my attention that subsequent to upgrading to perl
5.005_02 for Solaris 2.6, the a2p awk to perl utility no longer works.
feeding it an awk scripts results in no output whatsoever, and a return code
of '1'. I tried other 5.005_02 installations with the same results (or lack
thereof).
The same awk scripts feeds into a 5.004_01 a2p and translates as expected.
Any ideas?
Here's a small awk script for reference purposes:
BEGIN{
FS=",";
}
{
printf("%s\t%s\t%s\n",$1,$2,$3);
}
END{
}
Peace.
Bruce W. Hoylman (303-541-6557) -- bhoylma@uswest.com ._ 0
- __0 "I intend to live forever... /\/\ /\ / //\.
- - - _-\<,_ so far, so good." /~/~~\/\/~~\ ' \>> |
- __(_)/_(_)_____________________________/\ / \ \/\ \________\\ `_
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 29 Jan 1999 08:25:10 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Changing sort order on the fly...
Message-Id: <m1n232qc61.fsf@halfdome.holdit.com>
>>>>> "Ed" == Ed Overton <saseao@unx.sas.com> writes:
Ed> I'm working on a program where the user will supply the a sort
Ed> order for the output. I store my data in hashes, and keep an array
Ed> of references to the hashes. I've come up with one method, but I
Ed> feel like there's got to be a better way. A program using my
Ed> current solution is at the end of this post.
Ed> Obviously, I'm not going to create sort BLOCK statements for each
Ed> and every possible sort order. That leads me to using a subroutine
Ed> for sorting, and making the subroutine aware of the sort order.
You might be able to use Sort::Fields (found in the CPAN, written by
my buddy Joseph Hall) right out of the box. If not, study how
that module does it, write your own, and submit it to the CPAN!
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 29 Jan 1999 17:11:41 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Finding/Printing system uptime in perl
Message-Id: <78sq4d$m2i$2@news0-alterdial.uu.net>
Daniel <daniel.mendyke@digital.com> wrote:
> What is a quick and dirty way to print system uptime
> from a perl script? System is RedHat linux on an i386.
How 'bout this:
@uptimes = (`uptime` =~ /load average: ([\d\.]+), ([\d\.]+), ([\d\.]+)/);
die "uptime failed" unless $? == 0;
Hey, you said you wanted quick 'n dirty... this is both. You might want
to beef up the regex a bit to accept \s+ where I have single spaces. Or
not.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Fri, 29 Jan 1999 12:29:57 -0500
From: sra@idx.com (Steve Alpert)
Subject: Re: Getting the last number in an IP addr with a regex.
Message-Id: <36b4f197.82207838@news>
Ala Qumsieh <aqumsieh@matrox.com> wrote:
>
>[posted and emailed]
>
>"Kim Saunders" <kims@tip.net.au> writes:
>
>> could someone please help me with a regex to give me the last number in an
>> IP address with a regex???
>
>If that is all that you need then:
>
>my $ip = '127.0.0.1';
>
>my ($last_no) = ($ip =~ /\.(\d+)$/);
how 'bout:
perl -e " $x = '1.4.2.8.9'; $x =~ /.*\.(\d+)/; print $1;"
put greed to your advantage!
Steve Alpert (Steve_Alpert @ i d x . c o m)
IDX Systems Corp. Boston, Massachusetts
------------------------------
Date: Fri, 29 Jan 1999 07:22:34 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: Good CGI Book
Message-Id: <MPG.111b7215ca7dee709896d8@news.sonic.net>
I'd have to recommend the Perl Cookbook. While it fully explains
everything, it will take me a long time to absorb it's knowledge. I will
probably never find it useless.
[ also published by O'Reilly ]
-Sam
In article <36b0e141$0$16666@nntp1.ba.best.com>,
nessus@shell5.ba.best.com says...
> Tom Renic <trenic@nortelnetworks.ca> wrote:
> : Can anyone suggest a very good CGI Textbook that is a good
> : starting point for a beginner, yet can act as a good desk reference
> : for an experience programmer?
>
> "CGI Programming on the World Wide Web", by Shishir Gundavaram,
> published by O'Reilly; ISBN 1-56592-168-2
>
>
------------------------------
Date: Fri, 29 Jan 1999 15:23:08 -0000
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: Help on deleting an item in an array?
Message-Id: <78sjhb$hru$1@starburst.uk.insnet.net>
Hi,
I am the original sender of the query, thanks to everyone in taking an
interest.
Now, I should have found the appropriate command myself, but this group is
great for getting a quick response.
What I was worried about was how the data is shifted around. My main
concern was that the way the splice command worked.
Is the data actually shifted down, or are the offsets to the data changed?
If there were 10,000 records and one was removed, that could be a lot of
data shifting down.
I am probably worrying for nothing, but my database is huge (and there are
hashes inside fred):
$fred[0]{'age'}=19;
$fred[0]{'blah'}='blah';
$fred[1]{'age'}=20;
and so on.
Thanks to all again.
Chris D
Uri Guttman wrote in message <39yamnt1ab.fsf@ibnets.com>...
>>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
>
> >> it is amazing how close splice is to control! assuming that it really
> >> only used .11 seconds more, the it is about 130 [ (19.03-4.77)/.11 ]
> >> times faster than the slice code. this is probably close to a record
for
> >> slow dumb code.
>
> LR> We could have a contest. My 'slow' side would certainly use 'eval
> LR> STRING' and I'll bet it could get worse than 130. :-)
>
>but i was refering to an honest newbie with dumb code. you are not a
>newbie, nor dumb, but who knows about honest?
>
>:-)
>
>uri
>
>--
>Uri Guttman Hacking Perl for Ironbridge
Networks
>uri@sysarch.com uri@ironbridgenetworks.com
------------------------------
Date: 29 Jan 1999 11:18:30 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: Help on deleting an item in an array?
Message-Id: <x7aez2rr1l.fsf@home.sysarch.com>
>>>>> "CD" == Chris Denman <c-denman@dircon.co.uk> writes:
CD> Is the data actually shifted down, or are the offsets to the data
CD> changed?
arrays have pinters to the data so only the pointers are moved around.
splice is the best way to remove internal (pop and shift are better for
the ends) array entries so just use it and don't worry, be happy, you
are programming in perl.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 29 Jan 1999 17:30:32 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: Help on deleting an item in an array?
Message-Id: <m3hfta11p3.fsf@joshua.panix.com>
"Chris Denman" <c-denman@dircon.co.uk> writes:
> Is the data actually shifted down, or are the offsets to the data changed?
>
> If there were 10,000 records and one was removed, that could be a lot of
> data shifting down.
>
> I am probably worrying for nothing, but my database is huge
You've now seen an example of how the Benchmark module works. Armed
with that example, and with the documentation for Benchmark.pm, and
with the documentation for perl data structures, functions, operators,
etc., you can now...
\ | | | | | | | | | | /
- Find Out For Yourself -
/ | | | | | | | | | | \
There was recently a good article in The Perl Journal about
benchmarking pitfalls, so you may want to buy that back issue (and
subscribe, while you're at it).
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 29 Jan 1999 15:37:27 GMT
From: dsf3g@node1.unix.Virginia.EDU (David Salvador Flores)
Subject: Help with simple Perl problem.
Message-Id: <78skjn$444$1@murdoch.acc.Virginia.EDU>
Hello there, folks. I'm currently learning Perl and have run into a
small problem. I've written a program to read a text file and print
it out. Its my first Perl program to speak of, and runs fine under
DOS, but when I try to run it on my University's UNIX machine I
get a syntax error. The offending lines are these:
-------
print "WHAT FILE DO YOU WISH TO PRINT?\n";
$thefile = <STDIN>;
open (INFILE, $thefile) or die "Sorry that file seems not to exist.\n";
-----
In DOS it runs fine, but my UNIX system (an RS6000 running perl5)
reports the following error:
syntax error in file printfile.pl at line 12, next 2 tokens ") or"
Execution of printfile.pl aborted due to compilation errors.
Line 12 is the third line of code above, and my UNIX machine will
run the program just fine as long as I REMark everything after
the second parenthesis: #or die "Sorry..." etc. But that, of course,
defeats the "file not found" error trap.
So what gives?
-Dave
------------------------------
Date: Fri, 29 Jan 1999 07:18:43 -0800
From: samc@empirewest.com (Sam Curren)
Subject: Re: How to use GDBM (Novice)
Message-Id: <MPG.111b712bf73295989896d7@news.sonic.net>
I could point to numerous sites that would provide a little information,
or you can see the quite excellent example in The Perl Cookbook. It fully
explains using tied %hash variables with various forms of DBM.
-Sam
In article <36B1B2F5.AAAE1E09@lgnet.lg.co.kr>, csyim@lgnet.lg.co.kr
says...
> I want to use GDBM.
> I'm novice. So I tried to find some sample script.
> But I couldn't find someone.
> Please advice to use GDBM with perl.
>
>
------------------------------
Date: 29 Jan 1999 17:08:15 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: installing perl
Message-Id: <78sptv$m2i$1@news0-alterdial.uu.net>
A. Nelson <mbane@s-crim1.dl.ac.uk> wrote:
> Current working directory /usr/local/perl5.005_02/x2p
> echo Makefile.SH cflags.SH | tr ' ' '\n' >.shlist
> Updating makefile...
> gcc -o miniperl miniperlmain.o libperl.a
> Undefined first referenced
> symbol in file
> log libperl.a(pp.o)
> pow libperl.a(pp.o)
> sqrt libperl.a(pp.o)
> floor libperl.a(pp.o)
> atan2 libperl.a(pp.o)
> exp libperl.a(pp.o)
> sin libperl.a(pp.o)
> cos libperl.a(pp.o)
> ld: fatal: Symbol referencing errors. No output written to miniperl
> *** Error code 1
> make: Fatal error: Command failed for target `miniperl'
Hmmm... those are all match functions... you must need the math library!
Look in your config.sh for the "libs=" line. Mine (Perl 5.00503 MT4,
Solaris 2.6) looks like this:
libs='-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc -lcrypt'
Note the "-lm"; I bet yours is missing this. If you like to live on the
edge, edit config.sh, add "-lm" to the "libs" line, and run
./Configure -S
make dep
make
etc. If you like to be a good boy and play by the rules, re-run
'./Configure', and keep your eyes open for where it asks for libraries
-- you'll see a prompt with your current "libs" setting. Add "-lm", and
carry on as usual.
Good luck --
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Fri, 29 Jan 1999 15:57:45 GMT
From: "Eric Gorely" <eric.gorely@mci.com>
Subject: Re: Learning perl
Message-Id: <ZTks2.29$7P6.2924@news.cwix.com>
It's actually in several places, but here's one:
http://agora.leeds.ac.uk/Perl/
There's probably a US site, but I didn't look.
(Search for perl, and then subsearch tutorial)
>
>Just curious, where is this tutorial?
>
>--
>Eugene
------------------------------
Date: 29 Jan 1999 17:37:43 +0100
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Limiting length of datasent from a text box
Message-Id: <m3d83y11d4.fsf@joshua.panix.com>
"Quentin Compson" <bcompson@yahoo.com> writes:
> How can I go about making sure someone doesn't send my script
> too much data in a text box?
>
> Should I test for length?
Gosh, no, you should test for HEIGHT!
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 29 Jan 1999 16:25:33 +0100
From: "Peter Zozulak" <zozulak@point.sk>
Subject: Re: LWP and multiple connections at the same time
Message-Id: <78sk6k$ceg@gringo.somi.sk>
Hi
I found perl module Parallel - it can do multiple connections at one time
......
It's somwhere in the CPAN archive.
Peter
------------------------------
Date: 29 Jan 1999 17:41:45 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: Jason Hagerty <hagerty@fidnet.com>
Subject: Re: NTFS directory traversal
Message-Id: <m3btji116e.fsf@joshua.panix.com>
Jason Hagerty <hagerty@fidnet.com> writes:
> I am new to writting perl, but I'm having a problem traversing a the
> NTFS directory tree.
[snip Yet Another Rewritten File::Find]
Here's one way. The first line is the crucial one.
use File::Find;
sub wanted { print "$File::Find::name\n" if some_criterion($_) }
find(\&wanted, 'c:/');
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 29 Jan 1999 12:57:58 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: ok please don't shoot me for this question
Message-Id: <x7yammq7vd.fsf@home.sysarch.com>
>>>>> "JK" == Jeff Kerrigan <jeff_kerrigan@hotmail.com> writes:
JK> It seems like people on this channel waste more time delivering
JK> sarcastic answers than the 2 seconds it takes to help out a
JK> newbie. Try Matt's Scripts Archive at:
JK> http://www.worldwidemart.com/scripts/
JK> It seems to be a popular place to get a lot of prewritten CGI scripts.
the reason we don't recommend that place is because those scripts are
buggy, unsupported, unmaintained, perl4ish, badly written, etc.
it is popular only with newbies who don't know any better. most denizens
of this groups don't go near there.
so which do you want, sarcasm or bad code? you decide.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 29 Jan 1999 15:16:52 GMT
From: ptimmins@netserv.unmc.edu
Subject: Omaha Perl Mongers Meeting
Message-Id: <78sjcp$jpn$1@nnrp1.dejanews.com>
The Omaha Perl Mongers will be meeting next week:
7:00 PM Monday, February 1, 1999
CSG Systems (Break Room)
2525 N 117th St
(in the North Park Complex just north and east of 120th and Blondo)
Sign in with Security and get a visitor's badge. They can tell
you how to get to the break room on level 2.
I'll be giving a "Regex Refresher" ... Jeffrey Friedl and Ilya Zakharevich
are specifically 'un-invited' (well, not really :) ... I'm comfortable
in the fantasy world I've created for myself in regard to regexes ...
Hope to see you there! Come on out and heckle me! I'll be 'fozzy bear',
and you can be one of the old guys up in the balcony!
Wakka Wakka Wakka!
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 15:41:42 -0000
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: outputting perl errors as html?
Message-Id: <78skk3$i7o$1@starburst.uk.insnet.net>
Anyone know a way to output perl errors with appropriate perl tags, so that
the errors are shown on this particular page?
I have lived without this for ages, there must be a way (other than
producing error free code!)
Chris D
------------------------------
Date: Fri, 29 Jan 1999 16:31:47 -0000
From: "Chris Denman" <c-denman@dircon.co.uk>
Subject: Re: outputting perl errors as html?
Message-Id: <78snhv$jav$1@starburst.uk.insnet.net>
Sorry, last message made no sense.
Should read as follows:
I need to output perl error messages as html, instead of getting the typical
default server error page.
Sorry about the confusion!
Chris D
Chris Denman wrote in message <78skk3$i7o$1@starburst.uk.insnet.net>...
>Anyone know a way to output perl errors with appropriate perl tags, so that
>the errors are shown on this particular page?
>
>I have lived without this for ages, there must be a way (other than
>producing error free code!)
>
>Chris D
>
>
------------------------------
Date: Fri, 29 Jan 1999 08:42:56 -0800
From: Jerome O'Neil <jeromeo@atrieva.com>
To: Chris Denman <c-denman@dircon.co.uk>
Subject: Re: outputting perl errors as html?
Message-Id: <36B1E510.4B9AB0D9@atrieva.com>
Chris Denman wrote:
>
> Anyone know a way to output perl errors with appropriate perl tags, so that
> the errors are shown on this particular page?
>
> I have lived without this for ages, there must be a way (other than
> producing error free code!)
>
> Chris D
I'm not sure what a "perl tag" is, or to what particular "page" you are
refering. I'm guessing you are generating HTML through CGI?
Try this.
$SIG{__DIE__} = \&oops
sub oops{
# Generate attractive error messages.
exit 1;
}
This works well for me. YMMV.
--
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: Fri, 29 Jan 1999 14:59:34 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Perl 4.0 Question
Message-Id: <F6BtnB.A50@world.std.com>
Matthew Foley <Matthew.Foley@rich.frb.org> writes:
>The return format is:
>Wed Jan 27 15:45:41 1999
>On my NT 4.0 server running perl 4.0 ( a requirement due to other
>constrains) this script doesn't not work, and I receive no error code.
The return value of localtime in a scalar context was undefined in
perl version 4.
Probably the best thing to do is to generate it yourself with
something like:
@weekdays = ('Sun', 'Mon' , 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
@months = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
'Sep', 'Oct', 'Nov', 'Dec');
@time = localtime(time());
$time = sprintf("%s %s %02d:%02d:%02d %d\n", $weekdays[$time[6]],
$months[$time[4]], $time[2], $time[1], $time[0],
1900+$time[5]);
>Does anyone have any insight as to how to extract the same sort of data
>in perl 4.0.1.8 ?
Don't go by the RCS revision number when quoting perl version
numbers. When it says:
This is perl, version 4.0
$RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
Patch level: 36
Copyright (c) 1989, 1990, 1991, Larry Wall
It means perl 4.036.
--
Andrew Langmead
------------------------------
Date: Fri, 29 Jan 1999 16:50:12 GMT
From: "Eric A. Sager" <eric.a.sager@boeing.com>
Subject: Perl 5.002 on AIX ---> Perl 5.0x on MkLinux (Problems)
Message-Id: <01be4ba7$7269a3a0$24948989@eric-sager.ca.boeing.com>
Greetings all -
I am getting an error on execution of even the simplest perl scripts on my
MkLinux DR3-era Perl system. I have a nice little program at work (AIX)
that works quite well but would like to tweak it at home on my MkLinux
(PowerMac) system. I changed the path in the she bang to reflect the
different location of the perl binary, but the script dies immediately on
execution. Doing some troubleshooting, it seems that nothing will work,
even the simplest hello world scripts!
basically what happens is this:
----------
I type at the $prompt: perl test.pl
computer spits out: on #! line at test.pl line 1
----------
My test.pl script contains two lines:
#!/usr/bin/perl -w
print("Hello World\n");
-----------
So, something is obviously amiss
If anyone has any experience with Perl on MkLinux or other suggestions, I
would welcome them...
TIA
Eric S.
--
Eric Sager
HSCT - Durability
425-965-0122
------------------------------
Date: Fri, 29 Jan 1999 16:46:18 +0100
From: Alexander Farber <eedalf@eed.ericsson.se>
Subject: perl module for zipping?
Message-Id: <36B1D7CA.F524F9B1@eed.ericsson.se>
Hi,
does anybody know a perl module for creating zip files?
I would like to write a CGI-script, which will create a
zip file "on the fly" out of files in some directory and
send it to the web browser.
The module Compress::Zlib 1.01 seems to handle the Z and
gz files only...
Thank you!
/Alex
------------------------------
Date: Fri, 29 Jan 1999 15:53:14 -0000
From: "Internet Advertising Limited" <studio@inta.net.uk>
Subject: Perl programmers needed in London
Message-Id: <78sl9n$ief$1@starburst.uk.insnet.net>
We have recently received funding to work on a new, exciting project based
in London.
We require programmers that have extensive knowledge of Perl and CGI.
Excellent pay and prospects for the right people.
Please reply via e-mail, or telephone 01268 771199 and ask for Iago Bellis.
------------------------------
Date: Fri, 29 Jan 1999 09:50:46 -0500
From: Bill Williams <biwillia@cisco.com>
Subject: Print OUT korn shell syntax in Perl script?
Message-Id: <36B1CAC6.9E209945@cisco.com>
Can you do the following in a perl script? I want to add the following
korn shell snippet
to a print out statement in perl ( I am trying to use perl to create a
korn shell template):
unset VOLS BUVOLS
I=0
while [ $I -lt ${#BASE[*]} ]
do
unset VOL
for V in ${BASE[$I]}
do
BUVOLS="$BUVOLS vC${V}"
VOL="$VOL $V"
done
VOLS[$I]="$VOL"
I=`expr $I + 1`
done
export BUVOLS VOLS BASE"
When I add the statement "print OUT "ksh statements";
it complains about key words like while, and it sees V as a
variable even though it's in quotes. And the statements with
"-lt" don't show up in the file either. I have even tried escaping
the statements with a "\"...
Is there a different escape sequence? Or anything I can do to
remedy this?
-b
--
Thanks,
__________________________
Bill Williams
ERP Systems Administrator
Cisco Systems - RTP-IS
------------------------------
Date: Fri, 29 Jan 1999 11:42:16 -0600
From: Tom Briles <tbriles@austin.ibm.com>
Subject: Re: Print OUT korn shell syntax in Perl script?
Message-Id: <36B1F2F8.A0C37DEC@austin.ibm.com>
Bill Williams wrote:
> When I add the statement "print OUT "ksh statements";
> it complains about key words like while, and it sees V as a
> variable even though it's in quotes. And the statements with
> "-lt" don't show up in the file either. I have even tried escaping
> the statements with a "\"...
>
> Is there a different escape sequence? Or anything I can do to
> remedy this?
Assuming I understand your question correctly, use a "here" document.
perldoc perldata
- Tom
------------------------------
Date: Fri, 29 Jan 1999 09:17:06 -0600
From: James Ludlow <ludlow@us.ibm.com>
Subject: Re: reading binary files
Message-Id: <36B1D0F2.CAFAB28@us.ibm.com>
miulin@erols.com wrote:
>
> I tried using the binmode() function to read in a binary file. Do anyone
> know how I can now analyze it? I also couldn't find information on the
I'm not sure what you mean by "analyze it". binmode() doesn't actually
read in any data from the file, if that's what's causing you trouble.
perldoc -f binmode
> bitwise shift operators, such as how to use them and what they can be used
> for. Please help.
perldoc perlop
The list of operators is right at the top.
--
James Ludlow (ludlow@us.ibm.com)
(Any opinions expressed are my own, not necessarily those of IBM)
------------------------------
Date: 29 Jan 1999 17:14:58 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: regex lib or Perl linked in?
Message-Id: <78sqai$m2i$3@news0-alterdial.uu.net>
jimmy <jimmy@globalSpam.org> wrote:
> What's a good way to add Perl's functionality to a C++ program: to link
> Perl in, or use a standalone regex library? If the latter, where would I
> get one? Anything freely available?
Depends how much of Perl's functionality you want. If all you need is
its totally killer regular expressions, there is an alternative: Philip
Hazel has written PCRE, "Perl Compatible Regular Expressions". It's
used to give Python (since 1.5) regular expressions that look awfully
familiar, but it was written for a mail program of some sort (ie. it's
quite general). See:
ftp://ftp.cus.cam.ac.uk/pub/software/programs/pcre/
More info in Modules/pypcre.c in any recent Python source distribution
(www.python.org).
Oh, of course you could always embed Perl if you need the full language.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: 29 Jan 1999 08:28:09 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Regexp matching
Message-Id: <m1k8y6qc12.fsf@halfdome.holdit.com>
>>>>> "Staffan" == Staffan Hdmdld <staham@algonet.se> writes:
Staffan> What I'm trying to do is to match a name in a string with
Staffan> numbers and other things. The name can contain a space or a
Staffan> colon sometimes. The only thing that is certain about the
Staffan> name is that it starts and ends with a letter, A-Z or a-z. I
Staffan> would like it to match everything inbetween the first and the
Staffan> last letter. The problem is when $ln contains a name that's
Staffan> just one character long.
($match) = $ln =~ /([a-zA-Z](.*[a-zA-Z])?)/;
I got this by thinking about the definition: it always starts with a
letter, then possibly there's more stuff upto and including another
letter, although that's optional.
print "Just another Perl hacker,"
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Fri, 29 Jan 1999 14:57:57 GMT
From: smanand@my-dejanews.com
Subject: SED command in PERL through HTML
Message-Id: <78si9f$imo$1@nnrp1.dejanews.com>
I am trying to execute a "sed" command in a UNIX PERL script which
is called by a HTML form file as below.
$x1 = `sed -f one.txt two.txt > three.txt`;
print $x1;
one.txt is the sed command file
two.txt is the file to be worked on
three.txt is the output file
The above works if I execute the above sed command from my UNIX shell
prompt. It copies two.txt to three.txt (without executing sed) if I
execute the above through PERL HTML.
the owner of the three.txt is "nobody" when I run through browser
the owner of the three.txt is "my login id" when I run through shell prompt
Please help
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Fri, 29 Jan 1999 16:55:07 GMT
From: droby@copyright.com
Subject: Re: Stopping a foreach loop
Message-Id: <78sp56$p9k$1@nnrp1.dejanews.com>
In article <36B0F90B.A7DFFA7E@us.ibm.com>,
James Ludlow <ludlow@us.ibm.com> wrote:
> Larry Rosler wrote:
> >
> > [Posted and a courtesy copy mailed.]
> >
> > In article <78qkep$uqm$1@nnrp1.dejanews.com> on Thu, 28 Jan 1999
> > 21:22:44 GMT, Ryan.Haman@mci.com <Ryan.Haman@mci.com> says...
> > > Is there anyway to break (stop) a foreach loop?
> >
> > perldoc -f last
> > perldoc -f return
> > perldoc -f exit
> > perldoc -f die
> > perldoc -f exec
> >
> > even (ugh!)
> >
> > perldoc -f goto
> >
> > That's off the top of my head. Did I miss any?
>
> system("/sbin/shutdown -r now");
>
system("kill -KILL $$");
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 29 Jan 1999 17:46:25 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Stopping a foreach loop
Message-Id: <78ss5h$1e5$1@pegasus.csx.cam.ac.uk>
In article <78sp56$p9k$1@nnrp1.dejanews.com>, <droby@copyright.com> wrote:
>
>system("kill -KILL $$");
That's an inappropriate use of "system".
kill 'KILL', $$;
is *much* more efficient. :-)
Mike Guy
------------------------------
Date: Fri, 29 Jan 1999 17:21:19 GMT
From: tommy927@my-dejanews.com
Subject: strange behaviour with tr///
Message-Id: <78sqm2$qsv$1@nnrp1.dejanews.com>
Hi
I have a little script that does rot13 encoding
while (<>) {
tr/a-mA-Mn-zN-Z/n-zN-Za-mA-M/;
print;
}
It works with everything i throw at it but when i try an underscore (_), it
returns M, which is kinda unexpected. I am using Perl 5.004
Any ideas? Thanks
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 29 Jan 1999 12:54:36 -0500
From: Uri Guttman <uri@home.sysarch.com>
Subject: Re: strange behaviour with tr///
Message-Id: <x71zkermlf.fsf@home.sysarch.com>
>>>>> "t" == tommy927 <tommy927@my-dejanews.com> writes:
t> while (<>) {
t> tr/a-mA-Mn-zN-Z/n-zN-Za-mA-M/;
t> print;
t> }
t> It works with everything i throw at it but when i try an underscore
t> (_), it returns M, which is kinda unexpected. I am using Perl
t> 5.004
what would you want it to return?
from perlop on tr///:
Otherwise, if the REPLACEMENTLIST is shorter than the SEARCHLIST, the
final character is replicated till it is long enough.
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire ---------------------- Perl, Internet, UNIX Consulting
uri@sysarch.com ------------------------------------ http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: Fri, 29 Jan 1999 08:40:12 -0800
From: Michael Peppler <mpeppler@mbay.net>
Subject: Re: Sybperl - Specifying the interface file
Message-Id: <36B1E46C.8491BBBB@mbay.net>
James Rajasingh wrote:
>
> Michael Mongeau wrote:
>
> > James Rajasingh <"rajasingh_james@"@jpmorgan.com> wrote in message
> > news:78q4ir$ks0$3@hardcopy.ny.jpmorgan.com...
> > >Hi All,
> > >
> > >I am new to perl and have got a few questions regarding use of the
> > >sybperl package.
> > >1) How do I specify the interface file to use when trying to connect to
> > >a SYBASE server using sybperl ?
> > >2) What version of sybperl do I need to accomplish 1)
> > >3) Is there a document somewhere which documents all the sybperl
> > >functions. I have a document
> > >is titled "Sybperl 2.0: Using the Sybase::CTlib module" but it does not
> > >tell me how to do 1)
> >
> > 1. The environment variable SYBASE is used to locate the interfaces file.
> > Just add this to your script:
> >
> > $ENV{'SYBASE'} = "/path/to/sybase"; (enter the correct path on your
> > system, or course)
> >
> > The interfaces file in this directory is the one used.
This does not work when you use CTlib, as CTlib needs access to
$SYBASE/locales and $SYBASE/charsets directories.
In DBlib use
dbsetifile("/path/to/interfaces/file");
In CTlib use
ct_config(CS_SET, CS_IFILE, "/path/to/interfaces/file", CS_CHAR_TYPE);
The man page is in the pod directory, and also on my web page (in html format).
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@mbay.net -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
------------------------------
Date: Fri, 29 Jan 1999 16:04:08 +0100
From: Richard Nilsson <qdtrini@jdicms88.ericsson.se>
Subject: Re: system 'stty', '-echo' on Win32???
Message-Id: <36B1CDE8.32ABAF23@jdicms88.ericsson.se>
Sam Holden wrote:
> <snip>
> If you read the documentation that comes with perl you would find :
>
> perlfaq8 : How do I ask the user for a password?
>
> Why don't people read the FAQ? If I can find it then so can you... I don't
> have any magical powers I've just read through the FAQ and so have a
> vague idea what is there and when something rings a bell I go and have
> a closer look...
>
> --
> Sam
>
> So I did some research. On the Web, of course. Big mistake...
> --Larry Wall
I do appologise. It's there, and even though I did look and couldn't find it,
a simple
"grep password *" in the pod directory would have given me perlfaq8. I'll be
more
careful next time.
/Richard
------------------------------
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 4779
**************************************