[10320] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 3913 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 7 03:07:17 1998

Date: Wed, 7 Oct 98 00:00:36 -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           Wed, 7 Oct 1998     Volume: 8 Number: 3913

Today's topics:
    Re: "restoring" hard references pcbel@my-dejanews.com
    Re: Are there any "perl.newbie" group or forum? (David A. Black)
    Re: Compile (Jon Bell)
    Re: Compile <aqumsieh@tigre.matrox.com>
        Connect on desired port with NT-Perl? (Vincent Fatica)
    Re: foreach peculiarities (Ronald J Kimball)
    Re: forms with perl bhoylma@uswest.com
    Re: ftp within a perl program <gadget@bc.sympatico.ca>
    Re: ftp within a perl program (Gerard Hammond)
    Re: Help converting C xor function to Perl? (Ronald J Kimball)
    Re: Help with Here Document (Tad McClellan)
        Help! Capturing both stderr and stdout at the same time (Pat Luther)
    Re: Help! Capturing both stderr and stdout at the same  (Mark-Jason Dominus)
    Re: How to pass a hash array to a sub program <aqumsieh@tigre.matrox.com>
    Re: Illegal seek from system call <psdspss@execpc.com>
    Re: Making the date look good <psdspss@execpc.com>
        Modifying Matt's Script 'Formmail' rob_y@my-dejanews.com
    Re: NEEDED: A good perl programer to... (Mike)
    Re: Omaha Perl Mongers - First Meeting ! (Ronald J Kimball)
    Re: Opening Perl documentation <jdf@pobox.com>
    Re: Opening Perl documentation (Mark-Jason Dominus)
    Re: perl html tag parser (Question refined) (Ronald J Kimball)
    Re: Perl/Html - mixing text and graphics <antti.boman***NOSP@M***helsinki.fi>
        Perl: time check question (Papadopoulos Stratos)
    Re: POLL: Perl features springing into your face (Ronald J Kimball)
        Problem passing values to represent arrays names. <joshi@ee.tamu.edu>
    Re: Problems Using a Compare Subroutine with Sort <garry@america.net>
    Re: Problems Using a Compare Subroutine with Sort <garry@america.net>
    Re: read subdirectories <jerryp.usenet@connected.demon.co.uk>
    Re: regexp with variable substitution values <Paul.Makepeace@POBox.com>
    Re: regexps and cntl chars <jdf@pobox.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Wed, 07 Oct 1998 05:56:57 GMT
From: pcbel@my-dejanews.com
Subject: Re: "restoring" hard references
Message-Id: <6vevr9$r6d$1@nnrp1.dejanews.com>



> but what you want is probably
>
> 	{
> 	    local %somehash;
> 	    # do something with %somehash
> 	}
> 	# now %somehash is restored
>
> or even:
>
> 	{
> 	    local %somehash = %somehash; # initialize with same value
> 	    # do something with %somehash
> 	}
>
> I bet this does everything you want from this construct.

Not quite. I realize it looks like my problem can be solved with the above
code. But it's a little more complex. %somehash is tied to a dbm, and the
environment is mod_perl. When the script is first run, I do:

dbmopen(%somehash,"db_english",0444);
$englishref=\%somehash;

# or

dbmopen(%somehash,"db_dutch",0444);
$dutchref=\%somehash;

depending on the selected language.

When the script "exits" the dbm will stay open. Next time the scripts is
started, the dbm for the selected dbm for the selected language might already
be open. If it is the same language as last time => no problem. %somehash
willl work as expected. If it's another language, eg. the open dbm is Dutch,
and I want to open English, the Dutch file has to stay open, so I can't just

closedbm(%somehash); # close Dutch
opendbm(%somehash,"db_english",0444);


I want %somehash to point to %$englishref...

Don't know if it's possible...

Thanks for the help.

Peter

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Tue,  6 Oct 1998 10:14:03 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Are there any "perl.newbie" group or forum?
Message-Id: <6vd8jb$jho$1@earth.superlink.net>

Hello -

Hauk Langlo <hauk@forumnett.no> writes:

>I'm sure there are a lot of people reluctant to post questions here
>afraid of having "RTFM" yelled in their face each time. I'm not an
>expert myselfe and I would really like to know if there are any
>discussion forums etc where it is actually legal to ask questions that
>might be of a basic nature to some. If you know about something like
>that, please let me know and me and probably a lot of other will go away
>and leave you guys alone.


But what good would it do to have beginners trying to answer each
others' questions?

I (intermediate Perl programmer, I like to think) spend a fair amount
of time helping people out, including people who need a boost to grasp
something that is explained in the documentation but just isn't coming
clear to them.  But there's a sort of ground zero of checking things
that everyone really should do before posting.  Of course one might
miss something, but still - grepping perlfaq* for "random" or "array"
or "shuffle" would have at least gotten you started.

Besides, I don't see what's so terrible about reading the documentation.
To put yourself in the right frame of mind, imagine that the docs
hadn't existed until today.  Then, suddenly, someone calls you and
excitedly says, "Guess what?!  Tens of thousands of words about the
Perl programming language, by its creators and maintainers, just
appeared for free on your hard disk!!"  Think how thrilled you'd be.


David Black
dblack@saturn.superlink.net

(P.S. See Nathan Torkington's semi-weekly "FAQ: ANSWERS TO YOUR QUESTIONS"
post.)


------------------------------

Date: Wed, 7 Oct 1998 04:17:52 GMT
From: jtbell@presby.edu (Jon Bell)
Subject: Re: Compile
Message-Id: <F0Fvxs.65u@presby.edu>

In article <6vd6dh$57b$1@srv4-poa.nutecnet.com.br>,
Commitman <commitman@digitalnet.com.br> wrote:
>How can I compile some perl program ??

Why do you want to compile it?  Compiling may not do you any good for what
you want to accomplish.

-- 
Jon Bell <jtbell@presby.edu>


------------------------------

Date: 06 Oct 1998 18:10:16 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: Compile
Message-Id: <x3ysoh1e3zr.fsf@tigre.matrox.com>


"Commitman" <commitman@digitalnet.com.br> writes:

> 
> Ps: Linux compilator !
> 

Hmmm.. I really want to make a sarcastic comment here. But maybe he
knows something that I don't! hmmmmmmm.....

> Commitman wrote in message <6vd6dh$57b$1@srv4-poa.nutecnet.com.br>...
> >How can I compile some perl program ??
> >
> >Is it possible ?
> >

-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


------------------------------

Date: Wed, 07 Oct 1998 04:49:23 GMT
From: vefatica@syr.edu (Vincent Fatica)
Subject: Connect on desired port with NT-Perl?
Message-Id: <361aef2e.459915753@news-server>

I'd like to test a network connection. When it goes bad (RoadRunner), "ping"
still works, so that's out. Presently, I'm using Kermit95 as follows (which I
hope is self-explanatory) to attempt a connection on the telnet port:

	k95 -C "set host <hostname>, if fail exit 1, hangup, exit 0"

I subsequently test K95's exit code.

I am a novice at Perl and know almost nothing about it's network capabilities. I
would appreciate an example of how to accomplish something similar with Perl. My
NT is 4.0; my Perl is 5.004.

Thank you.

 - Vince
___
   Vincent Fatica
   Syracuse University Mathematics
   vefatica@syr.edu
   http://barnyard.syr.edu/~vefatica/


------------------------------

Date: Wed, 7 Oct 1998 00:25:08 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: foreach peculiarities
Message-Id: <1dgi2yy.5crufophuupsN@bay1-117.quincy.ziplink.net>

[posted and mailed]

Dave Shaw <dshaw@iworks.interworks.org> wrote:

> I was trying to explain an aspect of 'foreach' processing to a friend and
> discovered that I didn't have a very good understanding of what was going
> on myself. I was trying to explain why the program:
>   #!perl5.4
>   # example 1
>   foreach $i ($x) {  # gets into the block one time
>     print "-$i-\n";  # prints '--'
>   }
> seemed to behave differently from the program:
>   #!perl5.4
>   # example 2
>   foreach $i (@x) {  # doesn't get into block at all
>     print "-$i-\n";
>   }
> 
> My explanation involved some hand waving describing how $x was undefined
> in example 1, and the "undef" value was an ok thing for foreach to try
> to iterate across, while the empty array @x didn't provide anything for
> foreach to iterate over. Even though it is also undefined..

That's more or less right.  For an array to be 'undefined' means it is
empty.  Consider the same programs, using constants instead:

  #!perl5.4
  # example 1
  foreach $i (undef) {  # one element in list
    print "-$i-\n";     # prints '--'
  }

  #!perl5.4
  # example 2
  foreach $i ( ) {      # zero elements in list
    print "-$i-\n";
  }


>   > If used in a context that requires a list value, a
>   > pattern match returns a list consisting of the
>   > subexpressions matched by the parentheses in the
>   > pattern.  If the match fails, a null array is
>   > returned.

This appears to be a bug in either Perl or the documentation.  In
perl5.004, it seems that if the match fails, m// returns '' regardless
of context.  Tack on /g, however, and () is returned in list context.

  DB<1> x @a = /z/
0  ''
  DB<2> x $a = /z/
0  ''
  DB<3> x @a = /z/g
  empty array
  DB<4> x $a = /z/g
0  ''

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Wed, 07 Oct 1998 06:44:40 GMT
From: bhoylma@uswest.com
Subject: Re: forms with perl
Message-Id: <6vf2ko$un8$1@nnrp1.dejanews.com>

In article <3618AD6A.42D2F98D@genxsys.com>,
  Steve Goodyear <sgoodyear@genxsys.com> wrote:
> Essentially I need to replace a standard HTML form using the POST method
> with a perl script...
>
> I'm not real sure where to start....
>
I'm sure you are aware your replacement perl script, a CGI-BIN directory
component, needs to be able to to POST/GET processing, form generation, form
field management, etc.  A good place to start is by looking on CPAN for the
most-excellent CGI.pm module, or URL-ing to
"http://www-genome.wi.mit.edu/ftp/pub/software/WWW/cgi_docs.html".

The basics of this type of logic are so easy they're fun.  Hope you enjoy
crafting your solution.

Peace.

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: Tue, 06 Oct 1998 21:01:59 -0700
From: Fred Richards <gadget@bc.sympatico.ca>
To: jbachofner <jbach@teleport.com>
Subject: Re: ftp within a perl program
Message-Id: <361AE7B7.EF415F95@bc.sympatico.ca>



jbachofner wrote:

> Anyone know how to ftp files from with in a perl script? I need to get
> files from a UNIX box daily and save them on a NT machine.
>
> Any help is appreciated.
>
> jeff Bachofner

Install the netbundle and try:

use strict;
use Net::FTP;

my $site = "www.bedrock.com";
my $UserName = "flintstone";
my $Password = "quarry";
my $file = "index.html";

my $ftp = Net::FTP->new("$site");

# Login to FTP site

print("\nLogin: $site ...");

$ftp->login($UserName, $Password) or die "\nlogin failed: $!";
print " OK\n";

$ftp->cwd("/temp/") or die "\ncwd failed: $!";

$ftp->binary() or die "\nbinary failed: $!";

$ftp->get($file) or die "\nget failed: $!";

$ftp->quit;





------------------------------

Date: Wed, 07 Oct 1998 15:39:57 +1000
From: g.hammond@garvan.unsw.edu.au (Gerard Hammond)
Subject: Re: ftp within a perl program
Message-Id: <g.hammond-0710981539570001@power.garvan.unsw.edu.au>

try this

print (`\/usr\/ucb\/ftp -i -n localhost \<\<\!\nuser $user_loginid $user_pa
ssword\nput thefile.txt\nquit\n`);


Dr Gerard Hammond


------------------------------

Date: Wed, 7 Oct 1998 00:25:12 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Help converting C xor function to Perl?
Message-Id: <1dgi3ib.4kis5e11hijz4N@bay1-117.quincy.ziplink.net>

[posted and mailed]

Sean Rietze <seanr@rmci.net> wrote:

> Can some C/Perl guru help me translate the following
> C function into Perl?

This message has nothing to do with Perl/Tk, probably nothing to do with
Perl modules, and likely not much to do with C++ either.  Please only
post to appropriate newsgroups.  Followups set.

> I am trying to convert a simple auth daemon that I found
> to Perl, but data being sent to me is XORed using this routine
> below.  Not sure exactly what this function is doing, the loops
> pretty obvious, but not sure what it is doing with the rest of
> this data.

Each character in the source string is xor-ed with the corresponding
character in the key string, and then assigned to the same position in
the destination string.  Repeat the key string as necessary.


Does this work?

> static void
> MScramble(unsigned char *dst, size_t dsize, unsigned char *src, char *key)
> {
>  int i;
>  unsigned int j = 0;
>  unsigned int x;
>  unsigned int ch;
>  unsigned char *k2;
>  size_t keyLen;
> 
>  keyLen = strlen(key);
>  k2 = (unsigned char *) key;
>  for (i=0; i < (int) dsize; i++) {
>   ch = src[i];
>   x = k2[j];
>   dst[i] = ch ^ x;
>   ++j;
>   if (j >= keyLen)
>    j = 0;
>  }
> } /* MScramble */

sub MScramble {
  my($src, $key) = @_;

  my $dst = '';
  my $i;
  my $j = 0;
  my $x;
  my $ch;

  for ($i=0; $i<length($src); ++$i) {
    $ch = ord substr($src, $i, 1);
    $x = ord substr($key, $j, 1);
    $dst .= chr($ch ^ $x);
    ++$j;
    $j = 0 if $j >= length ($key);
  }
  $dst;
}

> It is called like this...
> 
> /* Decode the request inline. */
> MScramble((unsigned char *) &astate, sizeof(astate), (unsigned char *)
> &astate, "\x7f\xff\xfe\xff");

$astate = MScramble($astate, "\x7f\xff\xfe\xff");

If you do that twice in a row:

$astate = MScramble($astate, "\x7f\xff\xfe\xff");
$astate = MScramble($astate, "\x7f\xff\xfe\xff");

You end up with the same string.  I assume that's the intended result.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Tue, 6 Oct 1998 22:45:04 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Help with Here Document
Message-Id: <04oev6.r34.ln@flash.net>

Andrew Perrella (ap85@cornell.edu) wrote:

:     Is it possible to use the "Here Document" method to print to a
: variable?


   No, you can't "print" to a variable.

   You can "assign" to a variable though  ;-)


$words =<<end_of_text;
Hello this is a atest
end_of_text


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


------------------------------

Date: 6 Oct 1998 21:12:06 -0700
From: t_patl@qualcomm.com (Pat Luther)
Subject: Help! Capturing both stderr and stdout at the same time.
Message-Id: <t_patl.907732820@gano>


Can someone give me some advice here? I'm relatively new to Perl
programming, and am completely stuck here:

I'm running a series of system() commands from a perl script (calling
another tool) - and I'm trying to capture both STDERR and STDOUT from
the commands into a logfile.

If I do something like:
open (STDOUT, ">$outfile");
open (STDERR, ">$outfile");

(Or if I replace any or all of the >'s with >>'s)

then run two system() commands, it will put the stdout of both into
$outfile, followed by the stderr of both.  But I want them put into 
the files in the order they're generated. That is, what I want is the
output in the order:
 	- First command's stdout
 	- First command's stderr
 	- Second command's stdout
 	- Second command's stderr
 But what I get is:
 	- First command's stdout
 	- Second command's stdout
 	- First command's stderr
 	- Second command's stderr
 	
 So can anyone tell me what I'm doing wrong here?
 (Of course, since I'm printing my own comments to the log file as
 well, it's actually worse than that......)
 
 					-Pat
 					
-- 
--
Pat Luther t_patl@qualcomm.com  http://www.cs.pdx.edu/~pluther
"Reality? Illusion? One thing I've learned is to always present
 a moving target."      -Jack Flanders


------------------------------

Date: 7 Oct 1998 00:55:03 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Help! Capturing both stderr and stdout at the same time.
Message-Id: <6ves77$e7d$1@monet.op.net>

In article <t_patl.907732820@gano>, Pat Luther <t_patl@qualcomm.com> wrote:
>it will put the stdout of both into
>$outfile, followed by the stderr of both.  But I want them put into 
>the files in the order they're generated.

See 

	http://www.plover.com/~mjd/perl/FAQs/Buffering.html

especially the section headed ``My output is coming out in the wrong order!''


------------------------------

Date: 06 Oct 1998 18:13:50 -0400
From: Ala Qumsieh <aqumsieh@tigre.matrox.com>
Subject: Re: How to pass a hash array to a sub program
Message-Id: <x3yr9wle3ts.fsf@tigre.matrox.com>


Ala Qumsieh <aqumsieh@tigre.matrox.com> writes:

> 
> ALMOST right ... $_ is undefined there!! so the statement 'each %{$_}'
> will return undef values. I think you meant
> 
> each %{%_[0]}
> 
> instead.

Of course that should've been:
each %{$_[0]}

my finger slipped one key to the right!

-- 
Ala Qumsieh             |  No .. not Just Another
ASIC Design Engineer    |  Perl Hacker!!!!!
Matrox Graphics Inc.    |
Montreal, Quebec        |  (Not yet!)


------------------------------

Date: Wed, 07 Oct 1998 00:18:24 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Illegal seek from system call
Message-Id: <6vesuh$7vt@newsops.execpc.com>

This is because system calls return 0 on success and non-zero value on
failure.
For ||, 0 is false and non-zero is true. (Reverse of system)

|| is short circuit operator. For ||, Second predicate gets executed, only
when the
first fails. Since system call returns 0, die is executed.

Hope that helps.
Deva

Asa C. Martin wrote:

> Hi all,
>
> I've been taught that it's a good idea to check the return on all system
> functions. But one of my programs dies when I do. Here are the lines
> (for example):
>
> $file = "some_file.Z";
> system("uncompress $file") || die "can't uncompress $file: $!\n";
>
> When I run this I get
> % can't uncompress some_file.Z: Illegal seek
>
> (BTW, it works the same when written system("uncompress", "$file"))
>
> If I take away the "|| die" it runs fine. What am I missing? Am I in
> danger by not testing the return of the uncompress?
>
> - Asa Martin





------------------------------

Date: Wed, 07 Oct 1998 00:05:10 -0500
From: Deva Seetharam <psdspss@execpc.com>
Subject: Re: Making the date look good
Message-Id: <6ves5m$7vt@newsops.execpc.com>

Try this :
$x=localtime(time);
print "$x\n";

Output is
Wed Oct  7 00:03:31 1998
Hope that helps.
Deva

brettr wrote:

> How can I convert something like this "10/06/98 06:41:13 CDT" into something
> like this "Tuesday, October 06, 1998"?
>
> brettr





------------------------------

Date: Wed, 07 Oct 1998 06:37:28 GMT
From: rob_y@my-dejanews.com
Subject: Modifying Matt's Script 'Formmail'
Message-Id: <6vf278$ubr$1@nnrp1.dejanews.com>

I'm in need of a little help from the perl experts.  I'm trying to use Matt's
Script 'Formmail' but I can't get the script to work unless the user specifies
an email address.

I have the value on the form page set as value=""  and I'd like to add a
subroutine that checks if the email value="" and replaces it with something
like nobody@nobody.com.  This way the user doesn't have to give out their
address and the script will still work.

I know how to do this in VBScript and JavaScript, but not in Perl.  I'd
appreciate any help.  You can view the script online at
http://www.worldwidemart.com/scripts/cgi-
bin/download.cgi?s=formmail&c=txt&f=FormMail.pl

Thanks again in advance,
Rob Y

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


------------------------------

Date: 7 Oct 1998 03:53:37 GMT
From: schutzmd@SPAMFREEjmu.edu (Mike)
Subject: Re: NEEDED: A good perl programer to...
Message-Id: <6veok1$hcf$1@lark.jmu.edu>

Elaine -HappyFunBall- Ashton (eashton@bbnplanet.com) wrote:

> My point was that noone offers what they are willing to pay up front. It
> is a matter of doing business, both sides know their price point,
> negotiation ensues if interest is there.

Point was well received.  My point reworded entirely:  I like to look in
c.l.p.m for two things:
     1.  Help with problems that I am having,
     2.  Fun things to play with.
If I were looking for a job, or to make money on the side, I would more
likely try a .jobs. newsgroup, or something with a bit more of a "matter
of doing business" atmosphere.

I apologize, that is how I should have worded it to begin with.

- mike -


------------------------------

Date: Wed, 7 Oct 1998 00:25:16 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: Omaha Perl Mongers - First Meeting !
Message-Id: <1dgi4ti.12sj5er1uqbamnN@bay1-117.quincy.ziplink.net>

David Adler <dha@panix.com> wrote:

> >( follow the 'Omaha, the Beautiful' link to see the top 10 reasons
> > why Omaha should host the year 2000 Perl Conference! )
> 
> Hey, watch it buddy.  We East Coasters called dibs on that one at the
> 1998 conference...

I've forgotten...  Why is it that we called dibs on the top 10 reasons
why Omaha should host the year 2000 Perl Conference?

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: 07 Oct 1998 06:19:04 +0200
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Opening Perl documentation
Message-Id: <m3hfxhhumf.fsf@joshua.panix.com>

kpreid@ibm.net (Kevin Reid) writes:

> Unfortunately, AFAIK, perldoc is specific to UNIX

FWIW, perldoc also works on the Win32 platform. I feel like "perldoc"
is to "read this doc" as "Kleenex" is to "facial tissue", if you know
what I mean.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


------------------------------

Date: 7 Oct 1998 00:57:25 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Opening Perl documentation
Message-Id: <6vesbl$e82$1@monet.op.net>

In article <1dgi1y4.1rhqn7q5gm2coN@slip-32-100-246-124.ny.us.ibm.net>,
Kevin Reid <kpreid@ibm.net> wrote:
>I think it would be useful to have a way to open up a given section of
>the Perl documentation (or the documentation for a particular module)
>built into the standard Perl distribution; perhaps like this:
> ...

Let us know when you get it finished!




------------------------------

Date: Wed, 7 Oct 1998 00:25:17 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: perl html tag parser (Question refined)
Message-Id: <1dgi5hh.1cez8t21kecjj5N@bay1-117.quincy.ziplink.net>

<ekaull@my-dejanews.com> wrote:

>  if ($listing[$index]=~/href+\s*\=+\"+(.*)\s*\"+/i) # 1.  FIND IT

Sure, if you want to match (in its entirety):

q{hrefff   ==="""abc   """_____hrefff   ==="""xyz"""}

with $1 set to:

q{abc   """_____hrefff   ==="""xyz""}



I'm afraid it's not looking good.  I'll also recommend HTML::Parse.

-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Wed, 7 Oct 1998 09:31:17 +0200
From: "Antti Boman" <antti.boman***NOSP@M***helsinki.fi>
Subject: Re: Perl/Html - mixing text and graphics
Message-Id: <6vf26a$kvs$1@hiisi.inet.fi>

>>How about...
>>   print "<img src="/images/bitmaps/".$AREA".gif" width=400 height=250>";
>>...?
>
>orpheus:~$ perl -e 'print "<img src="/images/bitmaps/".$AREA".gif"
width=400 height=250>"'
>Illegal division by zero at -e line 1.


Damn, one of those untested quote mistakes.

-a




------------------------------

Date: Wed, 07 Oct 1998 07:34:19 GMT
From: stratos@alexandros.cperi.forth.gr (Papadopoulos Stratos)
Subject: Perl: time check question
Message-Id: <361b1761.2393581@news-ath.forthnet.gr>

I am writting a Perl script for time checking. Is it possible to
retrieve the local time through a time server, instead of reading
it from the local web server (using the date function)?

I would be grateful if you can send me a code fragment that performs
such a function.

Thanks in advance
Stratos


------------------------------

Date: Wed, 7 Oct 1998 00:25:07 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: POLL: Perl features springing into your face
Message-Id: <1dgi10a.1a56gd0tjktbwN@bay1-117.quincy.ziplink.net>

<cpierce1@ford.com> wrote:

> Please let me be the FIRST to abuse this feature:
> 
> use barewords a..zzzz;

*rofl*

Would this pragma be retroactive?  I think you would have to do this
instead:

use barewords 'a'..'zzzz';


-- 
 _ / '  _      /         - aka -         rjk@coos.dartmouth.edu
( /)//)//)(//)/(     Ronald J Kimball      chipmunk@m-net.arbornet.org
    /                                  http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


------------------------------

Date: Wed, 7 Oct 1998 00:30:01 -0500
From: Sanjay Joshi <joshi@ee.tamu.edu>
Subject: Problem passing values to represent arrays names.
Message-Id: <Pine.SOL.3.96.981007002810.26073C-100000@eesun1.tamu.edu>

I have a matrix like this:
  | a   b   c
--------------
x | 1   2   3
y | 4   5   6 
z | 7   8   9

I have this structure set up in this form in a HTML table, of course there
are no numbers, just images to click to call the cgi script.  This matrix
works both ways. So,

x(a) = 1 and a(x) = 1
similarly
z(c) = 9 and c(z) = 9

1. If you click on the intersection of 'a' and 'x', it should return 1. 

2. If you click on 'a', it should return 1, 4 and 7.

3. If you click on 'z', you should get 7, 8 and 9

I am able to pass the values of the row and column to the cgi.  Inside the
cgi script, there is a loop which reads the numbers. The arrays work in
both directions *inside* the loop i.e x(a) and a(x).  But when I use a
value passed from the HTML file (as a scalar, $row) and try to access
$row{$column}, it doesnt work. It doesn't recognize the array name but
recognizes the subscript. Can someone help me with this? 


Sanjay
------------------------------------------------------------------------
Sanjay Joshi                                   http://ee.tamu.edu/~joshi
------------------------------------------------------------------------



------------------------------

Date: Wed, 07 Oct 1998 06:15:20 GMT
From: "Garry T. Williams" <garry@america.net>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <361B074C.10E6971C@america.net>

Lloyd Zusman wrote:
[...]
> > [ ... ] The real problem is
> > using a numeric compare to sort IP addresses.  They are strings and a
> > string compare is the only way to order them.
> 
> I'm sorry to say that I'm not in agreement here.  Consider this:
> 
>    @a = qw( 2.100.100.100 30.10.100.100 100.99.10.10
>             100.100.10.10 100.101.10.10 );
> 
>    foreach $item (sort { $a cmp $b } @a) {
>       print "   $item\n";
>    }
[...]

Jeesh!  I thought this was beat to death.  Use an ST with inet_aton and
*string* compare the 32-bit IP addresses.  

-Garry Williams


------------------------------

Date: Wed, 07 Oct 1998 06:27:28 GMT
From: "Garry T. Williams" <garry@america.net>
Subject: Re: Problems Using a Compare Subroutine with Sort
Message-Id: <361B0A23.890FFF90@america.net>

John Porter wrote:
> 
> Garry T. Williams wrote:
> >
> > I don't believe that interpreting 0xffffffff as a minus one is a bug.
> > That *is* minus one (assuming a 32-bit word size).
> 
> No, it entirely depends on whether the word is being treated as
> signed or unsigned.  I think it's clear we are only interested in
> treating these numbers as unsigned.  If Perl lacks a way to force
> the interpretation of words as unsigned, then that's a problem
> with Perl.  I have not encountered that problem, however.
> 
> > The real problem is using a numeric compare to sort IP addresses.
> > They are strings and a string compare is the only way to order them.
> 
> I'm sorry, Garry, but that is utterly false.
> IP addresses are unsigned 32-bit numbers.

That's another way to say it's a 32-bit *string* (since there's never a
need to do any arithmetic on them).  Since there seems to be no reliable
way to get an *unsigned* numeric interpretation of a 4-byte thingie, use
a string compare to order them.  That's all I meant.  It's absurd to
consider sorting the dotted-quad character strings (at least without
"normalizing" them).  

> The dotted-decimal notations are for human convenience only.
> 
> How I wish the IETF (or whatever) had chosen to specify
> dotted-hex with zero padding, instead of decimal; everyone's
> life would be so much easier.

Here, here!  Especially network specifications involving subnets and
masks.  

-Garry Williams


------------------------------

Date: Tue, 6 Oct 1998 18:39:11 +0100
From: Jerry Pank <jerryp.usenet@connected.demon.co.uk>
Subject: Re: read subdirectories
Message-Id: <Y3wJ4PA$WlG2EwBS@connected.demon.co.uk>

In <comp.lang.perl.misc> 
John Porter <jdporter@min.net>, writes:
>Pete Ratzlaff wrote:
>> 
>> Here's one I wrote up in a hurry which recursively prints all
>> subdirectories of a given directory. Modify to suit your own needs:
>
>I sure do wonder what people have against using standard, robust,
>portable modules like File::Find.
>
<PEDANT> It's not Taint friendly </PEDANT>  :-)
-- Jerry Pank                    mailto:jerryp.usenet@netconnected.com

You have to admit that it's difficult to misplace the Perl sources.  :-)
-- Larry Wall in <1992Aug26.184221.29627@netlabs.com>


------------------------------

Date: Wed, 7 Oct 1998 04:30:28 +0100
From: "Paul Makepeace" <Paul.Makepeace@POBox.com>
Subject: Re: regexp with variable substitution values
Message-Id: <6vet89$n2u$1@statler.server.colt.net>

[Posted & mailed to author]

Larry Rosler wrote in message ...
>[Posted to comp.lang.perl.misc and a copy mailed.]
>
>In article <6ve6pg$6q0$1@statler.server.colt.net> on Tue, 6 Oct 1998
>22:07:43 +0100, Paul Makepeace <Paul.Makepeace@POBox.com> says...
>> Tom Phoenix wrote in message ...
>...
>> >    $string =~ s/subtag/$array[$i++]/g;
>>
>> $string =~ s/subtag/$array[$i++]/ge;    # NB /e !
>>
>> ...shurely?
>
>How s[h]ure are you?

Less sure now ;-) Doh...


>Did you bother to test it before posting?

Actually yes. I always test code before posting, although the "just 'cos it
compiles doesn't means it works" adage clearly applies...

I had:

paul$ perl -we '@values = qw(a b c);  $str = "X X X"; $i = 0; $str =~
s/X/$values[$i++]/ge; print "$str\n"'
a b c
paul$

Evidently you didn't test to see mine _didn't_ work ;-)
So, why did it work?


> Sheesh!
Brand Hilton wrote:
> BZZZT!  Thank you for playing :-)


Paul, browned on both sides, who promises not to post after 1am BST. (Doh,
again)




------------------------------

Date: 07 Oct 1998 06:15:59 +0200
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: regexps and cntl chars
Message-Id: <m3iuhxhurk.fsf@joshua.panix.com>

pfeilgm@jmu.edu writes:

> I want do substitution on some control characters.
> 
> Obviously, "s/^M/\n/g" and such won't work.  How can I do this?

See perlop and perlre: "\cM". 

  perl -pi -e 'y/\cM//d' dosfile.txt

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf


------------------------------

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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 3913
**************************************

home help back first fref pref prev next nref lref last post