[11874] in Perl-Users-Digest
Perl-Users Digest, Issue: 5474 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Apr 24 16:07:26 1999
Date: Sat, 24 Apr 99 13:00:20 -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           Sat, 24 Apr 1999     Volume: 8 Number: 5474
Today's topics:
    Re: chomp-ing from the FRONT end (Abigail)
    Re: Different between recurrence and looping <zerez@netvision.net.il>
    Re: FAQ 4.36: Why don't my E<lt>E<lt>HERE documents wor (John Stanley)
    Re: Generating a unique string for order number (Abigail)
        Has anyone here used perl to hack C-ISAM dat files dire <corlando@NOTpop.phnx.uswest.net>
        Help:How to find Pixel size of an uploaded image using  ltif@my-dejanews.com
    Re: Help:How to find Pixel size of an uploaded image us <gellyfish@gellyfish.com>
    Re: How to make an array name to be a variable? <cassell@mail.cor.epa.gov>
    Re: How to read the modification date of a file? (Lee)
    Re: How to read the modification date of a file? <dgris@moiraine.dimensional.com>
        HTML::LinkExtor, help <aramakri@cse.unl.edu>
    Re: Newbie regex query (Tad McClellan)
        Perl & ftp problem <paljetak@student.math.hr>
        Perl & ftp problem (Nikola Paljetak)
    Re: Perl & ftp problem <dimitrio@sympatico.ca>
    Re: Perl CGI and HTML... <staffan@ngb.se>
    Re: Problems with the connect function (Abigail)
    Re: Problems with the connect function (Abigail)
    Re: Question: Opening and closing files. (Tad McClellan)
    Re: Question: Opening and closing files. (Abigail)
        Regular Expression help ham@nospam.com
    Re: Regular Expression help <gellyfish@gellyfish.com>
    Re: See how you compare to our Top Ten list of perl pro <koehler@nm-us.campuscwix.net>
    Re: See how you compare to our Top Ten list of perl pro <gellyfish@gellyfish.com>
    Re: See how you compare to our Top Ten list of perl pro <cassell@mail.cor.epa.gov>
    Re: SSI calls <cassell@mail.cor.epa.gov>
    Re: TCP/IP beginner (Michel Dalle)
    Re: The docs as talking books (was Re: newbie with a "h <cassell@mail.cor.epa.gov>
    Re: Truncate doesn't work (Abigail)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 24 Apr 1999 19:41:11 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: chomp-ing from the FRONT end
Message-Id: <7ft6on$jbl$4@client2.news.psi.net>
mcti@my-dejanews.com (mcti@my-dejanews.com) wrote on MMLXI September
MCMXCIII in <URL:news:7fqdh1$a72$1@nnrp1.dejanews.com>:
;; is there an easy way to do the same as "chomp" or "chop" but have it remove a
;; character from the FRONT end of a string, rather than the back end?
chip() has once been proposed for such a function, but that never made it.
Use substr:
   substr $str => 1, 0 = '';
Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Sat, 24 Apr 1999 20:23:06 +0300
From: Erez Zuler <zerez@netvision.net.il>
Subject: Re: Different between recurrence and looping
Message-Id: <3721FDFA.75C1E0A2@netvision.net.il>
Basically, everything that can be done with recursive calls can be done also
without recursive call.  Recursive calls uses less 'programmer' recourses in
favor of system recourses.
Erez
Russell Harper wrote:
> I think you mean recursive call or recursion. There are cases where using
> loop logic to solve a problem is much harder than by recursion. A well
> known example is the Tower of Hanoi problem. With recursive logic, the
> problem is trivial, I wouldn't attempt it with any other approach. Good
> luck... /Russell
>
> Carfield Yim wrote:
>
> > It seen that looping can do the work of recurrence call, is there any
> > different other than concept? Why do we need to study more?
------------------------------
Date: 24 Apr 1999 19:47:11 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: FAQ 4.36: Why don't my E<lt>E<lt>HERE documents work?
Message-Id: <7ft73v$2h3$1@news.NERO.NET>
In article <3721c76f@cs.colorado.edu>,
Tom Christiansen  <perlfaq-suggestions@perl.com> wrote:
>(This excerpt from perlfaq4 - Data Manipulation 
Please repost this with the correct subject.
------------------------------
Date: 24 Apr 1999 19:51:25 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Generating a unique string for order number
Message-Id: <7ft7bt$jbl$5@client2.news.psi.net>
Greg McCann (gregm@well.com) wrote on MMLXI September MCMXCIII in
<URL:news:3720BA19.CCAFE84D@well.com>:
,, Benjamin Franz wrote:
,, > >Yes, process ids repeat, but (except in science fiction and on horribly
,, > >misconfigured machines) time doesn't.  Two things may be submitted at
,, > >the same time, but then their PID would be different.  Two things may be
,, > >submitted with the same PID, but then their time would be different. So
,, > >concatenating time and process id would give a unique id wouldn't it?
,, > 
,, > Yes, with a caveat. If your machine is fast enough and busy enough to
,, > cycle its complete PID space in less than one wall clock second and you
,, > use a low resolution time source such as 'time', you could get the same
,, > PID and time for two difference processes. But you are not likely to
,, > encounter a situation like that in practice.
,, 
,, Not on *nix.  However on NT, PIDs are not consecutive numbers.  NT has a scheme
,, (incomprehensible to me) by which PIDs are not consecutive and are recycled
,, rather quickly.  For example if I run...
,, 
,, perl -e "print $$"
,, 
,, from the command prompt on my NT, the PIDs repeat a predictable sequence after a
,, mere 17 (seventeen) iterations!  On a busy server it is quite conceivable that
,, this could happen within one second.
,, 
,, However, this is just my development system and the final application will be
,, deployed on *nix.  So what I have tentatively decided on is...
But does every Unix garantee PIDs will be in consecutive order?
,, # generate unique order number
,, my $order_time = time;
,, my $order_pid = '0' x (5 - length($$)) . $$;
,, my $order_no = '0' x (10 - length($order_time)) . $order_time;
,, $order_no = substr($order_no, 0, 5) . '-' . substr($order_no, 5, 5) . '-' .
,, $order_pid;
,, 
,, BTW, I'm assuming that PIDs do not get larger than 5 digits - is that safe?
16 bits give you at most 5 digits. But who says there aren't Unices out
there (or will be next week) that use 32 bit PIDs?
One problem with creating unique number by concatting PID and time is having
multiple machines. If in 3 months, you application is a success, but running
it on one machine isn't going to work anymore, and it's decided that it's now
going to be run on 5 machines, your "unique" numbers might no longer be unique.
Abigail
-- 
perl -wle 'print "Prime" if ("m" x shift) !~ m m^\m?$|^(\m\m+?)\1+$mm'
------------------------------
Date: Fri, 23 Apr 1999 22:23:56 -0700
From: "AWKYOU" <corlando@NOTpop.phnx.uswest.net>
Subject: Has anyone here used perl to hack C-ISAM dat files directly?
Message-Id: <7xcU2.359$473.36707@news.uswest.net>
Just wondering if anyone here has used perl to read/manipulate C-ISAM files
directly.  I know there's probaly more elegant ways to access the data but I
get perverse enjoyment out of chopping up various types of data files and
spitting out reports/delimited files.
------------------------------
Date: Sat, 24 Apr 1999 18:14:57 GMT
From: ltif@my-dejanews.com
Subject: Help:How to find Pixel size of an uploaded image using CGI?
Message-Id: <7ft1mu$esr$1@nnrp1.dejanews.com>
Dear Experts with Good Hearts,
When user is uploading an image (.gif or .jpeg) into
our LINUX/APACHE server using his/her
browser, how can we find out the pixel size of the image
using CGI (of course we can do it offline using paintshoppro)?
Background information: We're using upload script
from www.terminalp.com/scripts
Thanks a bunch!
Neil Ray
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
------------------------------
Date: 24 Apr 1999 19:00:02 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Help:How to find Pixel size of an uploaded image using CGI?
Message-Id: <7ft4bi$32n$1@gellyfish.btinternet.com>
On Sat, 24 Apr 1999 18:14:57 GMT ltif@my-dejanews.com wrote:
> Dear Experts with Good Hearts,
> 
My heart is black and evil wasayou ....
> When user is uploading an image (.gif or .jpeg) into
> our LINUX/APACHE server using his/her
> browser, how can we find out the pixel size of the image
> using CGI (of course we can do it offline using paintshoppro)?
> 
I figure that the module Image::Size available from CPAN does that -
though I have never had cause to use it myself not being a pornographer.
/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 24 Apr 1999 12:47:13 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to make an array name to be a variable?
Message-Id: <37221FC1.FDD6276C@mail.cor.epa.gov>
Matthew O. Persico wrote:
> 
> Staffan Liljas wrote:
> > [big snip]
> > Personally, I think hashes are gods greatest gift to the programmer. I
> > love them. If I could turn my wife into one, I would.
> >
> > Staffan
> 
> And just what does SHE think of this? :-)
I find that the phrase "What am I, chopped liver?" comes to mind at 
this moment...
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716
------------------------------
Date: Sat, 24 Apr 1999 12:06:03 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: How to read the modification date of a file?
Message-Id: <B347642B96682C4DC@204.112.166.88>
In article <7fsdpo$1vd$1@gellyfish.btinternet.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>On 22 Apr 1999 22:31:26 GMT Abigail wrote:
>> howitgolook (howitgolook@my-dejanews.com) wrote on MMLX September
>> MCMXCIII in <URL:news:7fnman$qgl$1@nnrp1.dejanews.com>:
>> -- How can I determine the modification date of a file on a remote server?
>> 
>> 
>> You NFS mount the disk and use the stat() command.
>> 
> statd ate my hamster
Never NFS mount a hamster.
Lee
------------------------------
Date: 24 Apr 1999 11:44:56 -0600
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: How to read the modification date of a file?
Message-Id: <m3vhel6hgn.fsf@moiraine.dimensional.com>
rlb@intrinsix.ca (Lee) writes:
> In article <7fsdpo$1vd$1@gellyfish.btinternet.com>,
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> 
> >On 22 Apr 1999 22:31:26 GMT Abigail wrote:
> >> howitgolook (howitgolook@my-dejanews.com) wrote on MMLX September
> >> MCMXCIII in <URL:news:7fnman$qgl$1@nnrp1.dejanews.com>:
> >> -- How can I determine the modification date of a file on a remote server?
> >> 
> >> 
> >> You NFS mount the disk and use the stat() command.
> >> 
> > statd ate my hamster
> 
> Never NFS mount a hamster.
i agree, fscking a hamster would suck.
dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: Sat, 24 Apr 1999 12:16:31 -0500
From: Ashok Ramakrishnan <aramakri@cse.unl.edu>
Subject: HTML::LinkExtor, help
Message-Id: <Pine.SGI.4.05.9904241159370.7572833-100000@cse.unl.edu>
Hi all,
i have something like this
while(condition) {
Browse();
}
sub Browse {
my (@links) = ();
 ...   
sub callback {
         my($tag, %attr) = @_;
         while (($key,$value) = each(%attr)){
        ...
        push(@links,$value);
        print "True 1\n" if (@links);
        }
}
my $p = HTML::LinkExtor->new(\&callback);
 ...
$p->parse($res->content);
print "True2\n" if (@links);
 ...
}
if Browse is called multiple times this is what happens...
###first call###
True 1
True 2
###second call###
True 1
###third call###
True 1
 ... and so on, 
The (@links) list gets initialized to zero elements after the call to the
LinkExtor.parse routine.
"True 2" never gets printed after the first time though
both the print statements check the same condition.. 
can any one help me out?
thanks,
Ashok Ramakrishnan
------------------------------
Date: Sat, 24 Apr 1999 08:00:15 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Newbie regex query
Message-Id: <fobsf7.dm.ln@magna.metronet.com>
Andy Elvey (andyelv@ibm.net) wrote:
: I've been having a go with regexes - in particular, using them to get a
: simple derivative (calculus) script going.  I'm trying to get the code
: to take a very 
: simple function like 7x3 (7 times "x" cubed) and return the derivative
: (21x2). 
: The code so far is as follows -   
: !#/usr/bin/perl
  ^^
  ^^ transposed
   Something tells me that we are not looking at the code
   that you are looking at.
   I usually stop reading posts once I discover that, since
   it is foolish to spend time on code that doesn't really
   exist.
   You can stop people from abandoning your post by using
   cut/paste for code instead of trying to type it all in.
   You have yet another bug on the first line as well:
      #!/usr/bin/perl -w
   Let perl help you find your mistakes.
: print "Enter a function : " ;
: while(<STDIN>) { 
:   if (/([0-9]*)([a-zA-Z]+)([0-9]*)/) 
               ^                  ^
               ^                  ^
   So if   $_='x'  you want to calculate the derivative?
   If digits are required, then don't let them be optional.
   You might also consider anchoring your pattern.
      /^([0-9]+)([a-zA-Z]+)([0-9]+)$/
       ^      ^                  ^ ^
       ^      ^                  ^ ^
:  {
:     print "Derivative is ($1*$3)$2($3)-1 \n" ; 
   You cannot interpolate Perl code, only scalars and arrays.
   print() takes a list of expressions, and prints the result
   of each expression, so you can do this:
          print 'Derivative is ', ($1*$3), $2, ($3)-1, " \n" ;
--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas
------------------------------
Date: Sat, 24 Apr 1999 19:45:06 +0200
From: "Nikola Paljetak" <paljetak@student.math.hr>
Subject: Perl & ftp problem
Message-Id: <7fsvvh$pgn$1@as102.tel.hr>
I am just a beginner in Perl-programming and I would appreciate if someone
could help me to solve this problem:
There is an input_file of given format:
file_name_to_get
URL_of_1st_ftp_server
URL_of_2nd_ftp_server
 .
 .
 .
URL_of_Nth_ftp_server
I should write a Perl-script which somehow, USING STANDARD UNIX FTP PROGRAM,
does the following:
Script should read from input_file the file_name_to_get and the
URL_of_1st_ftp_server and then try to connect to that server. If the
connection with server is not established in 60 sec (this is problematic - I
don't know how to do it), program gives up that host and tryes to connect to
the following one from the input_file!
If the connection is established, program gets the file from that host.
If the transfer is succesfully ended, the program quits, but if not, it
should try to connect again after 60 sec and continue with transfer.
If transfer does not succeed after the third try, program has to go to the
next host from input_file, etc...
------------------------------
Date: 24 Apr 1999 17:53:39 GMT
From: paljetak@student.math.hr (Nikola Paljetak)
Subject: Perl & ftp problem
Message-Id: <7ft0f3$85p$1@bagan.srce.hr>
I am just a beginner in Perl-programming and I would appreciate if someone
could help me to solve this problem:
There is an input_file of given format:
file_name_to_get
URL_of_1st_ftp_server
URL_of_2nd_ftp_server
 .
 .
 .
URL_of_Nth_ftp_server
I should write a Perl-script which somehow, USING STANDARD UNIX FTP PROGRAM,
does the following:
Script should read from input_file the file_name_to_get and the
URL_of_1st_ftp_server and then try to connect to that server. If the
connection with server is not established in 60 sec (this is problematic - I
don't know how to do it), program gives up that host and tryes to connect to
the following one from the input_file!
If the connection is established, program gets the file from that host.
If the transfer is succesfully ended, the program quits, but if not, it
should try to connect again after 60 sec and continue with transfer.
If transfer does not succeed after the third try, program has to go to the
next host from input_file, etc...
------------------------------
Date: Sat, 24 Apr 1999 19:53:06 GMT
From: Dimitri Ostapenko <dimitrio@sympatico.ca>
Subject: Re: Perl & ftp problem
Message-Id: <3722215F.92D8838F@sympatico.ca>
Nikola Paljetak wrote:
> 
> I am just a beginner in Perl-programming and I would appreciate if someone
> could help me to solve this problem:
> 
> There is an input_file of given format:
> 
> file_name_to_get
> URL_of_1st_ftp_server
> URL_of_2nd_ftp_server
> .
> .
> .
> URL_of_Nth_ftp_server
> 
> I should write a Perl-script which somehow, USING STANDARD UNIX FTP PROGRAM,
> does the following:
> 
> Script should read from input_file the file_name_to_get and the
> URL_of_1st_ftp_server and then try to connect to that server. If the
> connection with server is not established in 60 sec (this is problematic - I
> don't know how to do it), program gives up that host and tryes to connect to
> the following one from the input_file!
> 
> If the connection is established, program gets the file from that host.
> If the transfer is succesfully ended, the program quits, but if not, it
> should try to connect again after 60 sec and continue with transfer.
> 
> If transfer does not succeed after the third try, program has to go to the
> next host from input_file, etc...
Use Net::FTP. See example @ www.perlnow.com
Dimitri
------------------------------
Date: Sat, 24 Apr 1999 21:48:30 +0200
From: Staffan Liljas <staffan@ngb.se>
Subject: Re: Perl CGI and HTML...
Message-Id: <3722200E.19C5A91E@ngb.se>
Wesley Bohannon wrote:
> <!--#include virtual="/Engineering/Test/testengfooter.txt"-->
The helpful hint is that this looks like a server-side include. Anyhow,
it isn't anything that any browser would do anything with. If you
configure your server to interprete server-side includes in html files,
it will. However, it will not do it for returns from a cgi-script. To do
the include, the easiest way is the manual, using perl:
open TXT, "/Engineering/Test/testengfooter.txt" 
    or die "Couldn't open: $!";
print while <TXT>;
close TXT or die "Couldn't close: $!";
Good luck!
Staffan
------------------------------
Date: 24 Apr 1999 19:17:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Problems with the connect function
Message-Id: <7ft5cj$jbl$1@client2.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMLXI September MCMXCIII
in <URL:news:37208e2a@cs.colorado.edu>:
Some nitpicking.
;; :my($Server) = 'jaguar.ir.miami.edu'; 
;; :print "Content-type: text/html\n\n";
;; :print "<HTML>\n" ;
;; 
;; Is it really HTML?  I don't see a DOCTYPE or a DTD reference.
;; It sure doesn't look like proper HTML to me.
Yes, it is possible to omit the DOCTYPE. It will default to HTML 2.0 though.
;; :print "<TITLE></TITLE>\n" ;
;; 
;; That's a fascinating title.
Legal, but not in the spirit of HTML.
;; :print "</HEAD>\n" ;
;; :print "<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>\n" ;
;; 
;; You forgot to quote those values.  This is not complaint.
Actually, it's a bit more complicated. Values that are composed for just
letters and digits do not have to be quoted. This is correct syntax.
However, as it is written here, one would refer to colours with the
_names_ FFFFFF, 000000, etc. Would one to see white and black, #FFFFFF
and #000000 are correct, and _they_ have to be quoted.
;; I don't see <font> in the HTML 3.2 spec.  Where did
$ perl -nwle '$i ++ if /\bFONT\b/; END {print $i}' REC-html32.txt
13
$
;; :print 'Username : <INPUT TYPE="text" NAME="user"  SIZE="15" MAXLENGTH="30"
;; :>   Server Name:   <INPUT TYPE="text" NAME="mailServer"  SIZE="15"
;; 
;; Where is your semi-colon?  Shouldn't that be   instead?  Don't
No. The ';' is only needed if followed by something that could be part
of an entity.
;; you think it's pretty sloppy to omit the admittedly optional terminating
;; semi-colon on an entity?
Why? Do you always put a semi-colon after each statement in Perl? Also
if that's the last (or only) statement in a block?
Abigail
-- 
perl -wle '(1 x $_) !~ /^(11+)\1+$/ && print while ++ $_'
------------------------------
Date: 24 Apr 1999 19:19:45 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Problems with the connect function
Message-Id: <7ft5gh$jbl$2@client2.news.psi.net>
Tom Christiansen (tchrist@mox.perl.com) wrote on MMLXII September
MCMXCIII in <URL:news:3720fff1@cs.colorado.edu>:
--  [courtesy cc of this posting sent to cited author via email]
--
-- In comp.lang.perl.misc, 
--     lr@hpl.hp.com (Larry Rosler) writes:
-- :No comment on your skewering of the Perl code.  But you were at least a 
-- :tiny bit too harsh about the unquoted HTML.
--
-- I ran weblint with -pedantic.  Apparently it whinges more than 
-- you would prefer. :-)
weblint isn't a validator. It's a linter. If you want a validator, 
consider sgmls.
Abigail
-- 
perl -wlpe '}{$_=$.' file  # Count the number of lines.
------------------------------
Date: Sat, 24 Apr 1999 07:45:19 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Question: Opening and closing files.
Message-Id: <fsasf7.dm.ln@magna.metronet.com>
David Cassell (cassell@mail.cor.epa.gov) wrote:
: networks@skynet.co.uk wrote:
: > 
: > Once a file (text for example) has been opened by a perl script, can
: > another script open that file before the first script closes the file?
: > 
: > eg. a script opens a text file to search for a word, another script
: > also tries to open the same text file while the first script is still
: > searching the text file.
: You betchum, Red Rider.
: This sort of problem can lead to all sorts of horrible things,
: like corrupt data files.. and [gasp!] non-working web counters.  :-)
   That is true for this "sort" of problem, but not for this
   particular problem.
: Read up on flock() and the Fcntl module if you need to lock the files
: so that only one person at a time can ruin them.
   You only need to worry about file locking when you are going
   to _write_ to the file.
   (Or when trying to read when another program is writing)
   If the file is not updated when it might be read (as in
   searching a "static" file), then:
      multiple programs (or instances of the same program) can
      _read_ files "simultaneously" with no problem.
--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas
------------------------------
Date: 24 Apr 1999 19:23:35 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Question: Opening and closing files.
Message-Id: <7ft5nn$jbl$3@client2.news.psi.net>
David Cassell (cassell@mail.cor.epa.gov) wrote on MMLXII September
MCMXCIII in <URL:news:37210A44.47C2D26A@mail.cor.epa.gov>:
## networks@skynet.co.uk wrote:
## > 
## > Hi,
## > 
## > Can anyone answer this question?
## > 
## > Once a file (text for example) has been opened by a perl script, can
## > another script open that file before the first script closes the file?
## > 
## > eg. a script opens a text file to search for a word, another script
## > also tries to open the same text file while the first script is still
## > searching the text file.
## 
## You betchum, Red Rider.
## 
## This sort of problem can lead to all sorts of horrible things,
## like corrupt data files.. 
I certainly wouldn't hope so.
##                           and [gasp!] non-working web counters.  :-)
Well, yes, of course. If you only open your file for reader, the counter
wouldn't really increment, would it?
Abigail
-- 
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Sat, 24 Apr 1999 13:01:59 -0400
From: ham@nospam.com
Subject: Regular Expression help
Message-Id: <3721F907.CD12558D@nospam.com>
I have a string in a key-value format.
Here's the format:
key=value,key=value,key=value (no comma at the end)
I'd like to extract just the data before the = sign (key).  I know I can
use the split(), look for a pattern match (=value) and place the
unmatched values(key) in an array.
Data after the = sign can contain just about any character, including
the following:
    ; : - _ / \ \s
I'm having some trouble getting the regex pattern to work.  Any help
would be appreciated.  Thanks.
Note: I'm running Perl on Win32
------------------------------
Date: 24 Apr 1999 18:40:08 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Regular Expression help
Message-Id: <7ft368$2uo$1@gellyfish.btinternet.com>
On Sat, 24 Apr 1999 13:01:59 -0400 ham@nospam.com wrote:
> I have a string in a key-value format.
> 
> Here's the format:
> 
> key=value,key=value,key=value (no comma at the end)
> 
> I'd like to extract just the data before the = sign (key).  I know I can
> 
Just one split more :
#!/usr/bin/perl -w
use strict;
my $in_string = 'key1=value1,key2=value2,key3=value3,key4=value4';
my %hash = map { split /=/ } split /,/ , $in_string;
foreach ( keys %hash )
{
   print "$_ = $hash{$_}\n";
}
You like ?
/J\
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 24 Apr 1999 11:42:51 -0600
From: "Rick Koehler" <koehler@nm-us.campuscwix.net>
Subject: Re: See how you compare to our Top Ten list of perl programmers.
Message-Id: <7fsvr6$8uh$1@news.campuscwix.net>
Ann Marie Ludlow wrote:
>Dear perl Programmer,
>
>Strut your stuff!  See if you can score the scores to make our TOP TEN
>List and get your certification in the process, FREE!
[merciful snippifying]
Announcing FedUp, Inc's new free offer to marketing droids, our TOP TEN LIST of
annoying posters.  Just browse on over to devnull.FedUp.com and strut your
stuff on our web-based test.  To qualify as a Certified Annoying Poster, you must pass
the examination with a score of 2.00 or higher.  To be certified as a Master Annoying
Poster, you must obtain a score of 4.00 or higher.
Each time you post the same thinly-disguised marketing/head-hunter drivel, you will
be credited with a value of 1.0 on our test.  Please feel free to aggravate the members
of perl newsgroups with continued fishing expeditions in a attempt to create a demand
for your product.
>Thus far, the feedback has been extremely positive!
Ha ha, *that* activates my hilarity unit!
>Why bother getting certified by TekMetrics?
Exactly.
--
Rick Koehler
"Haricots, haricots, le fruit magique; plus que vous mangez, les plus vous toot" - Voltaire?
------------------------------
Date: 24 Apr 1999 19:15:34 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: See how you compare to our Top Ten list of perl programmers.
Message-Id: <7ft58m$32r$1@gellyfish.btinternet.com>
On Sat, 24 Apr 1999 15:21:51 GMT Mark-Jason Dominus wrote:
> In article <19990423234145.106$5E@newsreader.com>,
>>To qualify as a Certified perl Programmer, you must pass the examination
>>with a score of 2.75 or higher.
> 
> I took a look, and I notice that although they claim to impose a
> 180-second time limit on each question, the limit is imposed via
> javascript.
> 
Ho Ho Ho
> So if you want to get a really good score to this idiotic
> `ceritifcation', be sure to take it with javascript turned off in your
> browser, and then you can take as much time as you want on each
> question.
> 
Dont worry I did ... ;-}
> More to the point, it demonstrates pretty clearly the the value of any
> such `certification' is zero.
> 
Anyhow MJ Whatever happened to the original Perl Certification Program - 
I never got round to claiming my 'Certified Perl Coelocanth' certificate.
(Mrs Gellyfish denies any knowledge of what our real family name is :)
/J\
Certified Perl Invertebrate
-- 
Jonathan Stowe <jns@gellyfish.com>
Some of your questions answered:
<URL:http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm>
Hastings: <URL:http://www.newhoo.com/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sat, 24 Apr 1999 12:51:14 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: See how you compare to our Top Ten list of perl programmers.
Message-Id: <372220B2.D1BF68B8@mail.cor.epa.gov>
Ann Marie Ludlow wrote:
> 
> [a bunch of annoying drivel]
Hey, great news!  Now they're pestering *other* language newsgroups.
So perhaps they won't have the time to get back here as often.
I certainly don't think they're smart enough to *automate* this
post.
:-)
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716
------------------------------
Date: Sat, 24 Apr 1999 12:44:52 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: SSI calls
Message-Id: <37221F34.3CC27FD@mail.cor.epa.gov>
Brad Beiter wrote:
> 
> Sorry comrade J -- it is had to understand what you are saying....formulate
> sentences much???!!
I believe he said:
>> Come on amaze us tell us what you think this has to with Perl
which, if you add simple punctuation, becomes:
Come on, amaze us: tell us what you think this has to do with Perl.
That means:
This is a newsgroup for Perl programming issues.  Not a newsgroup
for every computer issue which might conceivably be written (or
re-written) in Perl.  You have an SSI issue, so you need to ask
in one of the appropriate CGI newsgroups, or perhaps in a newsgroup
devoted to your webserver.  This is not a Perl issue, even if some
of your code is in Perl.  And Perl is far more than a web-programming
language, whether you know it or not.
To use a metaphor, this is an SSI issue dressed up in a llama's coat.
I hope this helps,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716
------------------------------
Date: Sat, 24 Apr 1999 19:29:15 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: TCP/IP beginner
Message-Id: <7ft60q$7t8$2@xenon.inbe.net>
In article <7fsple$ctn$1@nntp1.atl.mindspring.net>, "michael" <support@inkfarm.com> wrote:
>I hope I am asking this correctly:
>How can I make a perl program "listen" and "write" to TCP/IP?
>
>-Michael Herder
By using "listen" and "write", obviously :-)
Well, you may want to add some "socket", "bind", "accept", "read" and "close" 
to that. Or use some variants, like "print SOCKET" and "<SOCKET>".
Try reading perlipc,
Michel.
--
aWebVisit - extracts visitor information from WWW logfiles and shows entry,
exit, transit and 'hit&run' pages, links followed, time spent per page, etc.
For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: Sat, 24 Apr 1999 12:25:19 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: The docs as talking books (was Re: newbie with a "howto" question)
Message-Id: <37221A9F.C39179FC@mail.cor.epa.gov>
Jonathan Stowe wrote:
> 
> [snippety...]
> To this end I have started work on the module Pod::Speech which will render
> the otherwise excellent but until now and in this respect severely limited
> Perl documenatation as the spoken word.  Initially the interface will be
> limited in comparison to say perldoc but Doris is going to do some work
> on integrating the functionality of PSI::ESP and it is hoped that the
> version to be included in the Perl 7 distribution will allow even the most
> profoundly idle to find the answers they need - in concert with development
> in the area of code generation we could find ourselves with a language
> where no-one will be required to know how to program or type a line of code.
I hope that your module is prepared to recognize the words it will hear
most often.  Like 'duh' and 'Burp!'
 
> One area where some feedback would be useful is as to who's voice should be
> used - Mrs Gellyfish is dead set on that of Sir Anthony Hopkins but I think
> that might be national bias on her part.  Suggestions ?
In this country, Sir Anthony will be remembered by the masses only as
Hannibal Lecter.  And while many of them deserve that fate, it
might have a negative impact on the frequency of use.  I suspect that
the American version will have to have Majel Barrett's voice, so
(l)users
will *know* it's a smart computer.  :-)
Although I personally would opt for Kathleen Turner...
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716
------------------------------
Date: 24 Apr 1999 19:59:42 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Truncate doesn't work
Message-Id: <7ft7re$jbl$6@client2.news.psi.net>
cryptoman@my-dejanews.com (cryptoman@my-dejanews.com) wrote on MMLXI
September MCMXCIII in <URL:news:7fqghb$d39$1@nnrp1.dejanews.com>:
== Hi,
== 
== What I am trying to do is remove some lines in a text's file but it doesn't
== work. I am using Perl 5.005_01 on Unix.The script I wrote is:
== 
== Open (Test, "+<test.txt") or die can't open test: $!";
== ...
== $LineAddr = tell(Test);
== truncate (Test, $LineAddr);
== 
== It works but at the next line of the line deleted it leavez some strange
== caracters: @@@@@@@@@@@@@@@@@@. And the number  of that caracter (@) depenses
== on number of caracter you deleted. Isn't it strange?
What do you mean "next line of the line deleted"? truncate() doesn't delete
"a line".  Everything after byte $LineAddr is *gone*.
Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
 .qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
 .qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
------------------------------
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 5474
**************************************