[6416] in Perl-Users-Digest
Perl-Users Digest, Issue: 41 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar  3 14:27:18 1997
Date: Mon, 3 Mar 97 11:00:28 -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           Mon, 3 Mar 1997     Volume: 8 Number: 41
Today's topics:
     Re: 'make install' never stops: Pl. Help on solaris 2.4 (Mark Allman )
     Anonymous Multi-Dimensional Hash Assignments <hlhamilt@rsn.hp.com>
     Re: Anonymous Multi-Dimensional Hash Assignments (Honza Pazdziora)
     Re: Anonymous Multi-Dimensional Hash Assignments (Honza Pazdziora)
     Re: Beginner - simple problem <jander@ml.com>
     Re: Beginner Perl/CGI (Maddox)
     Re: Calling PGP from a Perl CGI script (Craig S. Riter)
     Re: Can you create file on the fly with perl? (M.J.T. Guy)
     Compatibility of Perl on NT and Unix (Aviel Rubin)
     Re: Converting date "serial number" back to a "normal"  (Matthew D. Healy)
     Re: File reading error (M.J.T. Guy)
     Getting list of files in a path yu177535@yorku.ca
     Going from adequate to expert Perl (Peter Scott)
     Re: Graphical Perl for Win32 ()
     Re: how long before I can put down the books? (Jeffrey)
     How to flush in perl. (Bhasker Allam)
     Re: HOW to set up alias to perl command in unix shell ? <rra@cs.stanford.edu>
     Re: How to spam - legitimately (Abigail)
     Re: Inline subroutines? <seay@absyss.fr>
     Re: IP Address to Host Name code WANTED <jander@ml.com>
     Re: Newbie Perl / HTML Content-type question (Ben Thompson)
     Perl timing questions: <albury@csee.usf.edu>
     Problem with printing to a file handle.. <tcumbo@lynx.neu.edu>
     Programming Perl, ftp site, question <gjs@ucla.edu>
     Re: Redirect For MSIE and Windows NT (Ben Thompson)
     Re: Rookie Blues:format not terminating (M.J.T. Guy)
     seek and tell (Brian Menke)
     Sort to my brain explodes <davidr@netscape.com>
     Re: syntax error (Christopher Masto)
     Digest Administrivia (Last modified: 8 Jan 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Mar 1997 18:32:58 GMT
From: allman@pat.mdc.com (Mark Allman )
Subject: Re: 'make install' never stops: Pl. Help on solaris 2.4
Message-Id: <5ff5gq$dae@cisu2.jsc.nasa.gov>
In article <01bc2525.95d34580$648055ce@kakumanu.getnet.com>, Kumar Kakumanu <kumar@getnet.com> writes:
|> Hello:
|> 
|> I am new to Perl; I tried to install Perl 5.002 on Sparc solaris 2.4, the
|> 'make install'
|> went into some 'recursive' mode and it never stopped.  I had to control-c
|> it.
|> It started creating  *very* deep directories under /usr/local/lib/perl5,
|> some of them
|> had funny names like '[/'.
|> 
|> I had done the following.
|> 
|> sh Configure  			/* I accepted all the defaults */
|> make depend			/* worked fine */
|> make 				/* complained about Config.pm, but when I ran it again
|> 				   it indicated no errors */
|> make test			/* worked fine */
|> 
|> My question is why 'make install' never stopped creating directories? Is
|> there something
|> wrong I am doing?  Is Perl 5.002 a Beta?
I've seen this, but for the life of me I can't recall the cause.
One idea:  take a few minutes and read through your config.sh file
to verify that all the directory names you said to put things in
are actually valid directory names.  You may just have a typo.
Another idea:  you might've cut/paste a default name, and the defaults
are surrounded by "[]" pairs.  If you copied one extra character on
the left side then all your "install" directories start with "[/".
If I think of what I did to cause what you're seeing, I'll post it.
-- Mark Allman
-- Sr. Engineer, McDonnell Douglas Aerospace,  allman@pat.mdc.com
-- Software consulting (Perl, C, Python, ...), ghost@ghost.neosoft.com
-- (see: http://pup.princeton.edu/titles/5857.html)
------------------------------
Date: Mon, 03 Mar 1997 10:50:22 -0600
From: "Harlin L. Hamilton Jr." <hlhamilt@rsn.hp.com>
Subject: Anonymous Multi-Dimensional Hash Assignments
Message-Id: <331B014E.66CA@rsn.hp.com>
I realize that multi-dimensional hashes aren't really
multi-dimensional in the true sense, but I don't want
to start *that* argument...
I'd like to do the following with an anonymous hash assignment:
$x->{'a', 'b'} = 5;
I could do this:
$x = { "a$;b" => 5 }
But it seems clumsy.  Is there a better/easier way of doing this?
I looked through 'Programming Perl', 2nd edition, and the
'PERL5 How-To' without seeing an example of this.  I also
gave a somewhat cursory look through the online Perl FAQ without
results.
Thanks in advance,
Harlin!
hlhamilt@rsn.hp.com
------------------------------
Date: Mon, 3 Mar 1997 17:51:21 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Anonymous Multi-Dimensional Hash Assignments
Message-Id: <adelton.857411481@aisa.fi.muni.cz>
"Harlin L. Hamilton Jr." <hlhamilt@rsn.hp.com> writes:
> I realize that multi-dimensional hashes aren't really
> multi-dimensional in the true sense, but I don't want
> to start *that* argument...
> 
> I'd like to do the following with an anonymous hash assignment:
> 
> $x->{'a', 'b'} = 5;
> 
> I could do this:
> 
> $x = { "a$;b" => 5 }
Multidimensional hashes are in fact hashes of hashes, so you need to
write $x->{'a'}{'b'} = 5; Of course it works also with non-anonymous
hash: %x{'a'}{'b'} = 5;
Hope this helps.
--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: Mon, 3 Mar 1997 18:22:18 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: Anonymous Multi-Dimensional Hash Assignments
Message-Id: <adelton.857413338@aisa.fi.muni.cz>
adelton@fi.muni.cz (Honza Pazdziora) writes:
> Multidimensional hashes are in fact hashes of hashes, so you need to
> write $x->{'a'}{'b'} = 5; Of course it works also with non-anonymous
> hash: %x{'a'}{'b'} = 5;
Oops, should be $x{'a'}{'b'} = 5; of course.
--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------
------------------------------
Date: 03 Mar 1997 17:51:14 +0000
From: Jim Anderson  <jander@ml.com>
Subject: Re: Beginner - simple problem
Message-Id: <wkblo84hnjg.fsf@swapsdvlp15.i-did-not-set--mail-host-address--so-shoot-me>
turnerm@cs.man.ac.uk (Mark Turner) writes:
> Hi,
> 
> I am a newcomer to perl and as much I am enjoying using perl I have a little problem.  In my program I need the directory path.  I am trying to use the UNIX pwd command from perl, using the system() command, and trying to put the result into a variable $original_dir.  I have tried things like
> 
> 
> 
> system("pwd >$original_dir");
This writes to a _file_, not a variable.
> system("(pwd; >$original_dir &");
This one isn't woth discussing ;-)
Try this:
chomp ($original_dir = `pwd`); # NOTE: those are backticks
-- 
Jim Anderson			jander@ml.com
Consultant-at-large		jander@jander.com
				(212) 449-1598
------------------------------
Date: Mon, 03 Mar 1997 15:19:26 GMT
From: maddox@ican.net (Maddox)
Subject: Re: Beginner Perl/CGI
Message-Id: <331aeb44.5823226@news.ican.net>
On Sun, 02 Mar 1997 22:53:52 -0500, Mark Schwartz <fortune@in.net>
wrote:
>
>#!/usr/local/perl -w
>push(@INC, "/home/httpd/cgi-bin");
>require("cgi-lib.pl");
>
>I obtained cgi-lib.pl off of the CDROM that came with the book.  I made
>it executable:
>   chmod 777 cgi-lib.pl
>
>and I changed line one in that script to:
>   #!/usr/bin/perl
>
>which is where the Perl interpreter is located on my system (Red Hat
>Linux 4.0; Perl 5.003).
>
>If I shell out to a BASH prompt and run the script from the command
>line, I get:
>   Can't find string terminator "END_OF_TEXT" anywhere before EOF at
>   /home/httpd/cgi-bin/cgi-lib.pl line 96.
Hi there,
Most probably you have a semicolon where it shouldn't be... Basically
you should have END_OF_TEXT and not END_OF_TEXT; at the end of your
print run. (:
I got that exact message a few times and that was the cause... 
Later,
Steph
------------------------------
Date: Mon, 03 Mar 1997 18:47:42 GMT
From: criter@lucent.com (Craig S. Riter)
Subject: Re: Calling PGP from a Perl CGI script
Message-Id: <331d1c9f.16845333@nntp.cb.lucent.com>
I had the same problem.  It went away when I created a secret key for
the server.  I just created a private key for the server, doesn't
matter what name since it never signed anything and no one sent
anything to it.
It was the only way I could figure out.
Craig
criter@riter.com
On Mon, 03 Mar 1997 08:35:25 GMT,
"Martin_Khoo/SIN/Lotus"@crd.lotus.com wrote:
>Hi,
>
>I am trying to write a web frontend for PGP.
>
>There will be web form for user to select what file is to be encrypted
>and which public key to use. The problem i am facing now is that when
>pgp is called I get the following error :
>
>Preparing random session key...
>We need to generate 192 random bits.  This is done by measuring the
>time intervals between your keystrokes.  Please enter some random text
>on your keyboard until you hear the beep:
>cannot open tty, using stdin
>martin_khoo@lotus.com
______________________________________________________________________
Craig S. Riter         criter@riter.com         criter@povpartners.com
www.riter.com                           PGP key available upon request
It infuriates me to be wrong when I know I'm right.           -Moliere
------------------------------
Date: 3 Mar 1997 16:12:18 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Can you create file on the fly with perl?
Message-Id: <5fet92$23m@lyra.csx.cam.ac.uk>
Bill Kuhn  <wkuhn@uconect.net> wrote:
>> >system("touch $filename")
>> 
>> $filename = "harmless; rm -rf /";
>
>Are you telling me that whatever I pass to system() will be executed, so
>I shouldn't pass it anything that I don't want executed?  It will do
>exactly what I ask it to?
The moral of the story is _always_ use the multi-argument form of system,
i.e.
           system 'touch', $filename;
in this case, unless you _really need_ shell escapes.    It's more
efficient, and you'll avoid all sorts of security holes like this.
Mike Guy
------------------------------
Date: 3 Mar 1997 18:28:51 GMT
From: rubin@quip.eecs.umich.edu (Aviel Rubin)
Subject: Compatibility of Perl on NT and Unix
Message-Id: <5ff593$98a$1@news.eecs.umich.edu>
We have a program that uses forking and sockets in perl. It runs on
Unix without any problems. We are considering porting it to NT, and
we have no idea what the magnitude of the work will be. Can someone give
me an idea of how easy/hard an undertaking this usually is?
Thanks,
Avi
PS, please reply in e-mail as it's hard to keep up with this list.
------------------------------
Date: Mon, 03 Mar 1997 12:16:36 -0500
From: Matthew.Healy@yale.edu (Matthew D. Healy)
Subject: Re: Converting date "serial number" back to a "normal" date
Message-Id: <Matthew.Healy-0303971216360001@pudding.med.yale.edu>
In article <01bc22fe$6d64ee60$011618cb@caesar.bit.net.au>, "Andrew
Pollock" <apollock@bit.net.au> wrote:
> Hi,
> 
> I am trying to convert the output of a /bin/date +%j back into a normal
> date. I understand that this value is not the Julian date in the manner of
> speaking that the Date modules I have looked at from CPAN are talking
> about. Is there any easy way of doing this?
> 
> Eg. date +%j = 056, 56 = Feb 25, 1997.
> 
Um, the %j field in a date command gives the day of the year, so how
can you parse it without ambiguity?  Unless you are assuming it will
always be a "recent" date, and can make some assumptions about the
year.  Then you could do something like the following:
  1. Use a time() call to get the present Unix timestamp value in
     seconds
  2. Use a localtime() or gmtime() call to determine what day of the
     year it is right now from this timestamp in either your local zone
     or GMT*
  3. if the given day-of-year value is less than this, assume it's for an
     earlier date in the current year, so take present day of year
     minus given day-of-year, multiply by 86400, subtract from the
     timestamp you got in step 1, then use localtime or gmtime to
     convert that into what you need.
  4. if the given day-of-year value is greater than today's day-of
     year, then either the given day-of year is for a future date
     in this year OR it is from a prior year.  Only you know your
     application well enough to decide.  IF we can assume it's a
     day of last year, THEN we can do the following:
      4.1 determine whether last year was a leap year**, so you know
          whether the last day of last year was the 365th day of the
          year or the 366th day of the year
      4.2 subtract the last day from the given day, then add to the
          present day of the year -- that's how many days ago this
          was.  Now subtract 86400*days_ago from the timestamp found
          in step 1, and use localtime() or gmtime() to do the rest.
This will break if you give it a day-of-year value from more than
a year ago, unless you also store the year somewhere.
Look up time, localtime, and gmtime in the Camel book.  Here are (1)
a snippet from a Perl program that uses the localtime
call, and (2) a snippet from the localtime manpage:
(1)
$rightnow = time;
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdist) = localtime($rightnow);
(2)
     Declarations of all the functions and externals, and the  tm
     structure,  are  in the <time.h> header file.  The structure
     (of type) tm structure includes the following fields:
               int tm_sec;      /* seconds (0 - 59) */
               int tm_min;      /* minutes (0 - 59) */
               int tm_hour;     /* hours (0 - 23) */
               int tm_mday;     /* day of month (1 - 31) */
               int tm_mon;      /* month of year (0 - 11) */
               int tm_year;     /* year - 1900 */
               int tm_wday;     /* day of week (Sunday = 0) */
               int tm_yday;     /* day of year (0 - 365) */
               int tm_isdst;    /* 1 if DST in effect */
               char *tm_zone;   /* abbreviation of timezone name */
               long tm_gmtoff;  /* offset from GMT in seconds */
*in one wants to be really compulsive, one would note that it's probably
UTC and not GMT that one actually gets, but many programs still call it
GMT...
**if you care about 1900, you'll need to use the Gregorian formula
and not just "is it divisible by 4?"  Fortunately for programmers
everywhere, 2000 WILL be a leap year by BOTH Gregorian and Julian
rules...
---------
Matthew.Healy@yale.edu
http://paella.med.yale.edu/~healy
Go and share the Gospel.  Use words only if necessary --St Francis
------------------------------
Date: 3 Mar 1997 16:37:39 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: File reading error
Message-Id: <5feuoj$39d@lyra.csx.cam.ac.uk>
In article <331ACE45.31DF@sdrc.com>, Joe Kline  <Joe.Kline@sdrc.com> wrote:
>
>problem: get the following errors, but the script works fine they
>         annoy me to no end
I doubt the script is working fine  -  see below.
>the error:
>Read on closed filehandle <MASTERREP> at line 242
>
>the code snippet:
> 235  #  open master.rep file and read into memory
>   236
>   237     $file = "$result_dir/master.rep";
>   238     open(MASTERREP,"<$file");
Standard mistake #47:  not checking the return from open.  Try
            open(MASTERREP,"<$file") || die "Failed to read $file: $!\n";
>   239
>   240  #  sort file and write to an array
>   241     @masterrep = ();
>   242     @masterrep = sort(<MASTERREP>);
And here the filehandle isn't open because of above failure.
>   243     close(MASTERREP);   #  close master.rep file
Alternatively, if you are _expecting_ the open to fail, try something like
            @masterrep = ();
            open(MASTERREP,"<$file") &&
            do { @masterrep = sort(<MASTERREP>);
                 close(MASTERREP);   #  close master.rep file;
               };
Mike Guy
------------------------------
Date: Mon, 03 Mar 1997 12:21:30 -0600
From: yu177535@yorku.ca
Subject: Getting list of files in a path
Message-Id: <857412877.13097@dejanews.com>
Hi, I'm a newbie to Perl and I'm working on a script that needs to get the
listing of all *.jpg files in a directory.
@files = (<*.jpg>);
gets the listing of jpeg files in the current directory, how would I go
about getting a listing of the jpeg files in another directory?
I tried using chdir and then @files=(<*.jpg>) but it doesn't work.
Thanks in advance for any replies,
Babak
-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
------------------------------
Date: 3 Mar 1997 18:01:39 GMT
From: pjscott-remove-to-email@euclid.jpl.nasa.gov (Peter Scott)
Subject: Going from adequate to expert Perl
Message-Id: <5ff3m3$ev5@netline-fddi.jpl.nasa.gov>
This might sound familiar to a number of people out there.
I've been programming Perl for a few years now and can do a pretty
good job.  I know lots of shortcuts that Perl provides rather than
simply writing C-, or Fortran-, or Pascal-type code translated into
Perl.  Nevertheless, there are times when I look at code fragments
written by masters and think, I'm not even on the same planet.
So what does one do to make the transition?  Is there any better way
than just poring over CPAN and trying to understand the code?  Even if
not, whose code should I look at, which provides examples of good coding
along with sufficient comments to understand why particular choices were
made?
-- 
This is news.  This is your      |  Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?   |  (Peter.J.Scott@jpl.nasa.gov)
Disclaimer:  These comments are the personal opinions of the author, and 
have not been adopted, authorized, ratified, or approved by JPL.
------------------------------
Date: 3 Mar 1997 17:14:08 GMT
From: scott@lighthouse.softbase.com ()
Subject: Re: Graphical Perl for Win32
Message-Id: <5ff0t0$av2@mainsrv.main.nc.us>
Markus Laker (mlaker@contax.co.uk) wrote:
: I use Perl heavily at work, and it's a life saver.  If I could be
: granted one wish, though, it would be a graphical version for Win32 so
: that I could write little apps with pretty front ends for all my
: Windows 95 lusers.  Er, users.
Never gonna happen...I don't think.
You could probably use OLE Automation to drive Internet Explorer or
Word or something else with a powerful macro language to do your
interface for you. For that matter, you could write your UI in HTML and
JavaScript and kick off a perl program when you have all the data you
need.
I doubt anyone is going to do much more than port an existing
widget-language like Java or Tk/Tcl to Win32. The monumental task of
making Win32 API calls available in perl doesn't seem like it would be
worth it. All you could do is write old-style C + SDK programs, and in
this age of visual tools like Delphi and C++ Builder, who wants that?
The monumental effort of providing a widget-library similar to java.awt
doesn't seem worth it either. Maybe someone with too much time on their
hands will create "Visual Perl" with an MFC-like Perl OOP library for
UI widgets. I doubt it!
Delphi is only about $60-80 now. Use it to write front ends and call
your perl programs. Delphi is the perl for UIs, anyway.
Scott
------------------------------
Date: 03 Mar 1997 18:17:51 GMT
From: jfriedl@tubby.nff.ncl.omron.co.jp (Jeffrey)
To: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: how long before I can put down the books?
Message-Id: <JFRIEDL.97Mar4031751@tubby.nff.ncl.omron.co.jp>
[mail and post]
Randal Schwartz <merlyn@stonehenge.com> wrote:
|> So, don't feel bad if you can't keep this all in your head... we *all*
|> look at the manpages.  Even Larry.
I consistantly refer to the Perl Reference Card, _Programming Perl_, and
even my own book (_Mastering Regular Expressions_). Why should I spend my
limited brain cells to learn what I've already learned I can look up?
This is not an academic test -- in real life, you know everything you can
look up. Add a little skill in selecting what to put into your ``foreground
knowledge'' and you have someone that knows what they're doing.
Any programmer's real skill is not really measurable. As an analogy, my
high school Spanish teacher knew Spanish better than most native speakers,
I'm sure, but still couldn't teach worth shit. I'm sure I know more details
about Perl's regular expressions than anyone else alive, including Tom and
Larry, but I'm also very sure that I'm not nearly skillful in using the
language to solve problems as they are.
The above has been brought to you by BTW, FWIW industries, inc. :-)
	Jeffrey
----------------------------------------------------------------------------
Jeffrey Friedl <jfriedl@ora.com> Omron Corp, Nagaokakyo, Kyoto 617 Japan
O'Reilly & Associates' _Mastering Regular Expressions_
                                   http://enterprise.ic.gc.ca/~jfriedl/regex/
------------------------------
Date: 3 Mar 1997 18:08:58 GMT
From: abr@wasp (Bhasker Allam)
Subject: How to flush in perl.
Message-Id: <5ff43r$sgo@pcsi.pcsi.cirrus.com>
Hi,
Is there a way in perl to force the output of print to
to go the screen or file immediately. I want something
like flush(STDOUT). Thanks in advance.
Bhasker.
------------------------------
Date: 03 Mar 1997 09:45:05 -0800
From: Russ Allbery <rra@cs.stanford.edu>
To: josin@dimensional.com
Subject: Re: HOW to set up alias to perl command in unix shell ?
Message-Id: <qumn2skq38e.fsf@cyclone.stanford.edu>
[ Posted and mailed. ]
First of all, properly speaking, this is a comp.unix.shell question.  But
since I know the answer anyway, and you have a good subject line....
josin alvistur <josin@dimensional.com> writes:
> i am trying to set up an alias in tcsh to do:
> alias xx perl -e 'print "VAR1 = ", `printenv VAR1`;'
> (VAR1 is properly set in the environment)
Well, first of all, you're going to more work in Perl than you need to.
Second, you're getting screwed over by the shell quoting mechanism.  (This
is a common theme whenever trying to make aliases.)
See, when you enter in a line like that, tcsh parses the entire thing,
including the quotes.  So xx actually gets aliased to:
	perl -e print "VAR1 = ", `printenv VAR1`;
and then xx gets expanded to that.  This obviously isn't what you want,
since the above is an invalid command to just type in on the command line.
What you need to do instead is this:
	alias xx perl -e \''print "VAR1 = ", `printenv VAR1`;'\'
which is ugly as sin, but works.  What you do is put in two sets of
quotes, one for the time the alias line is parsed and another for the time
the command itself is parsed.
As it turns out, you're actually going to far too much work, since Perl
knows about environment variables.  There's no need to fork off a copy of
printenv.  Instead, just do:
	alias xx perl -e \''print "VAR1 = $ENV{VAR1}\n"'\'
I'm afraid I don't use bash (although I'm intending to switch to zsh one
of these days) because bash doesn't have programmable tab completion,
which is a make or break feature in an interactive shell for me.  I'm
therefore not familiar with its aliasing capability, but I believe the
quoting issues are similar.  (In general, bash's quoting is far less
braindead than tcsh's.)
-- 
Russ Allbery (rra@cs.stanford.edu)      <URL:http://www.eyrie.org/~eagle/>
------------------------------
Date: Mon, 3 Mar 1997 18:03:11 GMT
From: abigail@ny.fnx.com (Abigail)
Subject: Re: How to spam - legitimately
Message-Id: <E6HBHB.FxC@nonexistent.com>
On Mon, 03 Mar 1997 08:53:35 GMT, Terry Carroll wrote in comp.mail.misc,comp.mail.sendmail,comp.lang.perl.misc:
++
++ BTW, and I've seen this come up a number of times: I'm always amused to
++ see someone drop the line, as others have in this thread, to the effect
++ "I've never heard a native speaker of English use 'email' this way."
++ First, I can only conclude that the person saying that line has a pretty
++ limited circle of acquaintances.  I've heard and read a number of very
++ well educated people refer to an electronic message as "an email."  It's
++ very obvious to most people that well-educated native speakers of English
++ use the word "email" as a singular noun.  Second, it strikes me as little
++ more than an attempt to slide in a subtle ad hominem: "you must not be
++ well-educated -- you sound like a foreigner."  Finally, it strike me as
++ subtly racist.
I have to say, I never heard the word "emails" until I moved to the
USA. Specially my Canadian room mate is found of it, but others use
it too.
Abigail
------------------------------
Date: Mon, 03 Mar 1997 18:15:18 +0000
From: Douglas Seay <seay@absyss.fr>
To: deb@marinbridge.com
Subject: Re: Inline subroutines?
Message-Id: <331B1536.2466@absyss.fr>
Debbie Whitten wrote:
> 
> On page 539 of the 2nd edition Camel book it talks about inlining
> subroutines for time efficiency. I can't find any information on how to
> do this in the rest of the book. Does anyone have any ideas?
> 
> Thanks,
> 
> Deb
I thought that they ment to not use the subroutine at
all and just throw the subroutine's body directly where
the subroutine would be called.  you gain the time of
subroutine call/return overhead (saving scratch space,
noting where you were and what you were doing, I have
no idea what that would be in perl).  this is more or
less what C++ does when inlines something.
doug seay
seay@absyss.fr
------------------------------
Date: 03 Mar 1997 18:20:22 +0000
From: Jim Anderson  <jander@ml.com>
Subject: Re: IP Address to Host Name code WANTED
Message-Id: <wkbiv38hm6x.fsf@swapsdvlp15.i-did-not-set--mail-host-address--so-shoot-me>
mark@weymouth.gov.uk (Mark Perkins) writes:
> Hi,
> 
> Okay, I guess this is a bit cheeky, but I'm not clever enough to be
> able to work this out, has anyone got some code or knows of a way to
> do this in perl?
> 
> Should'nt this work?
> 
> $host = gethostbyaddr($ENV{'REMOTE_HOST'}, AF_INET);
> print "$host\n";
> 
> 
> Any help greatly appreciated.
use Socket;
($name) = gethostbyaddr pack('C4', split/\./, $ENV{REMOTE_HOST}), AF_INET;
-- 
Jim Anderson			jander@ml.com
Consultant-at-large		jander@jander.com
				(212) 449-1598
------------------------------
Date: Mon, 03 Mar 1997 08:43:19 GMT
From: ben@mendip.com (Ben Thompson)
Subject: Re: Newbie Perl / HTML Content-type question
Message-Id: <331a8d45.1216303@snews.zippo.com>
Wrong.
The problem is due to the implementation of Perl in Windows. The fact
that this problem relates mainly to IIS is irrelevent. Because the
problem only manifests itself when the user is running a Perl script,
most people assume that the problem is related to Perl (and hence this
is the most appropriate group).
Mind you, if you comment is the usual standard of you consultancy and
programming remind me never to employ you for any work. 
---
Given enough time I would have a web site. 
Unfortunately, I have to let my work speak for itself.
------------------------------
Date: Mon, 03 Mar 1997 10:40:26 -0500
From: Innuendo <albury@csee.usf.edu>
Subject: Perl timing questions:
Message-Id: <331AF0EA.5094@csee.usf.edu>
Can anyone clue me in as to a way to time operations in perl witha
granularity of less than 1 sec? 
I'm writing some socket based code to send packets around the internet
and i'd liek to be able to measure packet response time in milliseconds;
however the time module only supports increments as fine as 1 second.
Is it neccessary to somehow use syome type of system event of interupt
to count in milliseconds??
I'm at a loss here for the moment and i'd appreciate any pointers anyone
might have,
Thanks
Paul
------------------------------
Date: Mon, 03 Mar 1997 11:33:48 -0800
From: "Troy S. Cumbo" <tcumbo@lynx.neu.edu>
Subject: Problem with printing to a file handle..
Message-Id: <331B279C.67CB@lynx.neu.edu>
I have a small, easy problem.
I am writing a simple Perl script which reads in data (delimited by colons) from three small tables, and writes 
it to one file, with the addition of a few command line parameters.  The program reads the data, loads it into 
one big array, and then writes it out.  
The script correctly generates the array, but when it tries to write out to the output file, the result is that 
it tries to write around 8K of data (blank space) with the array to the file each time.  (There isn't anywhere 
NEAR 8K of data...just a few lines)
The filehandle is H_temp, and the array is called @M_line so my output line is:
print H_temp sort @M_Line;
Is there any Perl-based reason why this would occur?
Thanks
TSC
------------------------------
Date: Mon, 03 Mar 1997 07:32:12 -0800
From: Gregory Sherman <gjs@ucla.edu>
Subject: Programming Perl, ftp site, question
Message-Id: <331AEEFC.548B@ucla.edu>
The book "Programming Perl" mentions ftp sites where example 
code from the text is available, but the code isn't there.  Anyone
know where it can be found?
   Second, I would like to know what this line from page 27
is supposed to do:  $string =~ s/(\W)/\\$1/g;
------------------------------
Date: Mon, 03 Mar 1997 09:01:09 GMT
From: ben@mendip.com (Ben Thompson)
Subject: Re: Redirect For MSIE and Windows NT
Message-Id: <331b8fb8.1843083@snews.zippo.com>
(No doubt a number of idiots will complian that this is a question
about web servers but hee goes).
On NT Perl comes in three varieties, Perl, a Perl IIS extension (for
Microsofts IIS server) and Perl Script. 
What I would guess is happening is that the Web server is running the
IIS extension and hence is automatically sending a content type
header. Netscape is bright enough to listen for the second header (the
one the script sends) and uses follows the redirect command. MSIE only
listens for the first content type header and displays all the text
after it. 
The solution is to ensure thath the perl script uses the Perl.exe file
to execute the script not the IIS solution. If you used the default
settings all you will need to do is to change the extension of the
script to .pl rather than .plx, if not you might have to reinstall
Perl to ensure that perl.exe is called.
your,
Ben Thompson
---
Given enough time I would have a web site. 
Unfortunately, I have to let my work speak for itself.
------------------------------
Date: 3 Mar 1997 16:17:13 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Rookie Blues:format not terminating
Message-Id: <5feti9$2bg@lyra.csx.cam.ac.uk>
In article <857159166.18639@dejanews.com>,  <S_Stefanis@msn.com> wrote:
>I am trying to force out put with the format command
>I keep getting the following message:
>
>format not terminated in file. My code is as follows:
>
>format out_put =
>	@<<<<<<<<<<<  @<<<<<<<<<
>	$one,         $two[$i]
>	.
>
>write out_put;
>
>perhaps Im missing something? Thanks for your help!
You're missing the following from the perldiag man page:
=item Format not terminated
(F) A format must be terminated by a line with a solitary dot.  Perl got
                                                 ^^^^^^^^^^^^
to the end of your file without finding such a line.
Looks like that line of yours has some white space as well as the dot.
Mike Guy
------------------------------
Date: 3 Mar 1997 17:42:35 GMT
From: bmenke@wasco.synopsys.com (Brian Menke)
Subject: seek and tell
Message-Id: <5ff2ic$4vg@hermes.synopsys.com>
Sorry if someone has seen this question before. I am not sure that
it got posted last time.
I am trying to figure out how to use seek and tell to append to a file.
I have read the lamma book, but can't quite seem to figure out how to 
get is to do what I want, which is append to a file at my specified
location.
for example, I have the following file (test.html):
<html><head><title>This is a test</title></head>
<body>
Here is some text
</body>
</html>
Then, code snippet:
open(FILE, ">>test.html") || die "$!\n";
print FILE "Here is some more text\n";
Of course this text just get appended to the end of the file. What
I really want is to have the new text appended after the <body> tag
but before "here is some text"
I think the seek and tell functions are the way to go... but I just
don't get how to use them. Anyone know (Besides Randal or Tom that is :-)?
Thanks much!
-Brian M.
------------------------------
Date: Mon, 03 Mar 1997 09:36:16 -0800
From: David Richardson <davidr@netscape.com>
Subject: Sort to my brain explodes
Message-Id: <331B0C10.2D6E@netscape.com>
I am having a problem sorting a multi-dimensional array by one of it's
values.I have checked out the camel books and online Perl Faq but I am
still so confused. Let me start by telling you what I am trying to do. I
am opening up a dbm file via a hash array. At that point I am checking
for a particular value in a field and push that info. to a
multi-dimensional array. I want to sort the info by a value contained in
the multi-demensional array. I tried a number of ways of sorting the
info but no luck. The value I want to sort by would be $cool[$i]->[11]
dbmopen(%TE, $dbm_file, undef) || die "Cannot Open $dbm_file $!\n";
while (($key,$value) = each %TE) {
      local (@master_data)=(split(/\|/,$value));
      if ($master_data[9] == 17)  {
         @testit = splice(@master_data);
         unshift(@testit, "$key");
         push @cool, [ @testit ];
      }
}
#sub numer { $a <=> $b }
dbmclose %TE;
Any help would be appreciated I have been hacking this for a while and I
feel I am really stuck.
Thanks 
David R.
------------------------------
Date: 3 Mar 1997 16:18:55 GMT
From: exidor@nimbus.superior.net (Christopher Masto)
Subject: Re: syntax error
Message-Id: <5fetlf$ibq@news.webspan.net>
In article <Pine.GSO.3.95q.970223140953.18178J-100000@kelly.teleport.com>,
Tom Phoenix  <rootbeer@teleport.com> wrote:
>they crop up. Here's an example that bit me once. 
>
>    # Converting elapsed time to hours, minutes, 
>    # and seconds (the hard way, shoulda used a module).
>    $s = time - $start;
>    $m = int($s/60);    $s -= 60 * $m;
>    $h = int($h/60);    $m -= 60 * $h;
>    $duration = sprintf "%02d:%02d:%02d", $h, $m, s;
>    print "That procedure took $duration.\n";
>    print "This may vary depending upon system load.\n";
>    print "Why is there a syntax error on _this_ line?!\n";
Damn, that's a good one.  But when I loaded it into xemacs to fiddle,
cperl-mode's syntax coloring gave it away immediately.
-- 
Christopher Masto  .   .   .   .   NetMonger Communications
chris@masto.com  .   .   .   .   . Masto Consulting:           info@masto.com
------------------------------
Date: 8 Jan 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Jan 97)
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.  
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.
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 41
************************************