[8577] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2194 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 27 12:17:48 1998

Date: Fri, 27 Mar 98 09:00:25 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 27 Mar 1998     Volume: 8 Number: 2194

Today's topics:
    Re: Abort, Retry .. message in Win95 arvind.chhabra@inference.com
    Re: Anybody experienced in File-Locking with Perl5? eugene@vertical.net
    Re: Copy file command. <tchrist@mox.perl.com>
    Re: Dealing with the special chars in the file name (Andrew M. Langmead)
    Re: Flogging a Dead Horse Re: Primes via regexen (Abigail)
        Help anybody???password protected self-extracting files (Lalit Jairath)
    Re: help needed with grep type function for perl script (Andrew M. Langmead)
    Re: Help unpacking Little-Endian shorts and longs <Clinton.Bodine@mci.com>
    Re: How do I create a reference to a specific mem loc? (Andrew M. Langmead)
    Re: IMAP support? kjj@arf.eng.mcd.mot.com
        installing IO module on AIX <Richard.Schofield@fmr.com>
    Re: Need sorting routine in Perl (Kevin Reid)
    Re: Odd dereferencing behavior (Tom Grydeland)
    Re: Problems with handling Mac/PC/Unix line breaks joshmccormack@yahoo.com
    Re: PROPOSAL: The Perl Dictionary <merlyn@stonehenge.com>
    Re: proposal: while $line (<FILE>) (Jason Gloudon)
    Re: proposal: while $line (<FILE>) <dboorstein@shopcfn.com>
    Re: psmulti & perl5 <Mike_Lacey@Cargill.Com>
    Re: Redirect URL <beske@worldnet.att.net>
    Re: Still a novice (getting older) still needing RegExp (stephen benson)
    Re: ts: why have "push" and "unshift"? (Andrew M. Langmead)
        upgrade breakage? (Jay Allen)
        use Time::Local;  timelocal(, , , , , 1969) #year < EPO (PAF)
        using ftp.pl as included in perl 5.002 <Richard.Schofield@fmr.com>
    Re: verifying email address -- how? (User)
    Re: verifying email address -- how? <merlyn@stonehenge.com>
    Re: What is a JAPH <merlyn@stonehenge.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Mar 1998 09:49:50 -0600
From: arvind.chhabra@inference.com
Subject: Re: Abort, Retry .. message in Win95
Message-Id: <6fghmb$nn$1@nnrp1.dejanews.com>

Ignore this message. I found the cause of the problem. The virus checking
program was causing this error. The script works perfectly after I disabled
the virus checking program. I can't imagine what the connection is between
creating a file on C: drive and the virus program trying to access A: drive.
Maybe someone at McAfee / Microsoft / Activestate can figure it out.

- Arvind

In article <6fei5e$93m$1@nnrp1.dejanews.com>,
  arvind.chhabra@inference.com wrote:
>
> I am having a very strange problem while running Perl programs under Win 95.
> Any programs which have the "glob" function try to access the floppy drive,
> even though the path in the "glob" function does not refer to A: drive (I
> can hear the floppy drive making that sound) and I get an error message:
>
> General failure reading device
> Abort, Retry, Fail?
>
> The sample code is:
>
>     while (defined($in_file = <c:\\windows\\*.dll>))
>     {
>         print "Found file $in_file\n";
>     }
>     exit;
>
> The output is:
>
> General failure reading device
> Abort, Retry, Fail?f
> c:\windows\somedll.DLL c:\windows\anotherdll.DLL c:\windows\yetanother.DLL
>
> The output should be:
>
> Found file c:\windows\somedll.DLL
> Found file c:\windows\anotherdll.DLL
> Found file c:\windows\yetanother.DLL
>
> Does anyone have an idea what is happening?
>
> Similar thing happens when I try to run the following program:
>
>     open (IN_BUFF, ".\\someprog.exe |");
>     while (<IN_BUFF>)
>     {
>         print $_;
>     }
>     exit;
>
> Any help would be greatly appreciated.
>
> Thanks
>
> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/   Now offering spam-free web-based newsreading
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Fri, 27 Mar 1998 09:13:24 -0600
From: eugene@vertical.net
Subject: Re: Anybody experienced in File-Locking with Perl5?
Message-Id: <6fgfl5$uon$1@nnrp1.dejanews.com>

In article <EqDuwJ.3Kr@world.std.com>,
  aml@world.std.com (Andrew M. Langmead) wrote:

This is interesting.
The flock example in the Camel book (pp.166-167) does the opposite:
it unlocks the file without closing it.


> It is very likely that these constants are wrong. (I don't know of any
> systems that have numbers for these other than 2 and 8, but I wouldn't
> put it past some vender to do so. Just take a look at what Sun did to
> the sockeet constants.) You'd be much better off saying:
>
> use Fcntl qw(:flock);
>
> and using "LOCK_EX" "LOCK_UN" (but you really shouldn't use LOCK_UN,
> see below.)
>
> >flock FILE, $F_LOCK;
>
> You should check the return code to determine whether your flock
> succeeded.
>
> >flock FILE, $F_ULOCK;
> >close (FILE);
>
> Under almost all cases, you shouldn't unlock the file, the close()
> will do it for you. One function of close() is to flush the data your
> application has buffered to disk. If you unlock the file, you no
> longer have the lock when the final write system call is done. Later
> versions of perl help prevent this error by flushing the buffers
> before unlocking, but you should probably avoid unlocking anyway.
>
> You might also want to take a look at the flock entry in the perlfunc
> man page:
>
> <URL:http://www.perl.com/CPAN/doc/manual/html/pod/perlfunc/flock.html>
>
> --
> Andrew Langmead
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 27 Mar 1998 14:20:36 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Copy file command.
Message-Id: <6fgcjk$t4c$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen) writes:
:Have I been wrong in assuming that modules bundled with the distribution
:can be considered "standard" in some way?

Just because there's a module to do something doesn't mean it's a good
idea.  I'm not fond of telling people to use a module rather than 
their own brain just because it exists.  Just because there's a module for
getopt processing doesn't mean I always use it.  And *certainly* just
because there's a module for file handle bits doesn't mean I use it.

:BTW, the system() solution doesn't work with MacPerl for example. You may
:not care about that, but I'm sure others do. I do.

You're right.  I don't care, at least, not enough to really screw up my
coding or Perl.  I'm sorry that some users have their own penance to
pay in purgatory, but I'm not going to go to hell and back for them.
That's what you're asking, and I tell you that it is wrong.  (And you
should upgrade to an operating system.  Perhaps you might try Rhapsody.
Some people seem to like it. :-)

Listen:

Perl is a glue language.  It glues together, amongst other things,
programs.  Functions like system and exec and pipe opens and backticks
and qx and glob and fork are put in there for a reason.  They're there
to be used, don't you know?  If they weren't supposed to be used, Larry
would not have put them there.

It is very scary to me to see the current crusade to castrate Perl.
Once you take away Perl's ability to manipulate other programs, you cut
off its balls.  Capons we already have in abundance.  I don't want yet
another language that lives in its own world and reinvents the wheel
again and again.

That's not what Perl is about.  Programs are meant to be re-used.
The Unix tool-and-filter philosophy is alive and well; you ignore it at
your own peril.  Just because you live in a programmer-hostile world
doesn't mean that you have the right to drag others down with you.

Facilities are meant to be used.  I shall continue to write my code
using sockets and execs backticks and system and newlines and fork,
and I shall take up a jihad against those who would denigrate their use.
If you don't like them, don't use them, but the instant you tell others
that they are bad Perl, I shall throw down my gauntlet before you.

If you want Java, you know where to find it.  And it's not here.

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

Fifty years of programming language research, and we end up with C++ ???
		--Richard A. O'Keefe


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

Date: Fri, 27 Mar 1998 14:21:51 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Dealing with the special chars in the file name
Message-Id: <EqHEKF.BE@world.std.com>

Mike Hitchcock <mike@unival.com> writes:

>Andrew M. Langmead wrote:
> 
>> I guess you could also escape the metacharacters in the filename
>> before passing it to open():
>> 
>> # list of metacharacters from perl's do_exec function
>> $filename =~ s/([\$&*(){}\[\]'";\\|?<>~`\n])/\\$1/g;
>> open XXX, "your_lex_filter \"$filename\" |" or die;

>    quotemeta [quotemeta EXPR]

>    This function returns the value of EXPR (or $_
>    if not specified) with all non-alphanumeric characters
>    backslashed. 

You're right. I've always thought of quotemeta as only quoting regular
expression metacharacters. Since the rules for escaping shell
metacharacters and RE metacharacters are similar, it will work for
this as well.

By the way, the quotes I put in the open() function mess things up. It
should be:

$filename = quotemeta $filename;
open XXX, "your_lex_filter $filename |" or die;

-- 
Andrew Langmead


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

Date: 27 Mar 1998 16:36:50 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Flogging a Dead Horse Re: Primes via regexen
Message-Id: <6fgkj2$2g6$1@client3.news.psi.net>

Tom Christiansen (tchrist@mox.perl.com) wrote on MDCLXIX September
MCMXCIII in <URL: news:6ffm1r$cpa$1@csnews.cs.colorado.edu>:
++  [courtesy cc of this posting sent to cited author via email]
++ 
++ In comp.lang.perl.misc, abigail@fnx.com writes:
++ 
++ [various things about primes]
++ 
++ And here's this:
++  
++     # factor
++     for ($N = shift; (1 x $N) =~ /^(11+?)\1+$/; $N /= $factor) {
++         print $factor = length($1), " ";
++     }
++     print "$N\n";

Nice.

Slighty reworked:

perl -wle 'print join (" * ", do {for ($P = $N = shift; (1 x $N) =~ /^(11+?)\1+$/; $N /= ($l = length $1) and push @f, $l) {} (@f, $N)}), " = $P"'


Abigail
-- 
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle 'print +(HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET", "http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content)) =~ /(.*\))[-\s]+Additional/s) [0]'


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

Date: 27 Mar 1998 14:09:17 GMT
From: ljairath@wright.aps.uoguelph.ca (Lalit Jairath)
Subject: Help anybody???password protected self-extracting files in UNIX?
Message-Id: <6fgbud$lu5@ccshst05.uoguelph.ca>


Hallo Everybody,

i want to create password protected self-extracting files in UNIX(HP)- that 
could be later picked up from anonymous ftp site! how can i do that?


Pl. e-mail me @

ljairath@wright.aps.uoguelph.ca

Thankx.

Lalit
~~~~~


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

Date: Fri, 27 Mar 1998 14:31:53 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: help needed with grep type function for perl script.
Message-Id: <EqHF16.89C@world.std.com>

"Eric Winter" <ewinter@pop3.stx.com> writes:

>$str = "128\.0\.0\.2";

This should probably either be single quotes:

$str = '128\.0\.0\.2';

or the backslashes need to be escaped:

$str = "128\\.0\\.0\\.2";

Otherwise, the double quotes transform "\." to a lone dot, and it when
gets interpolated again in the regular expression:

>open(FILE, $filename);
>while (<FILE>) {
>    if (/$str/) {

The "." is then used as a regular expression metacharacter that
matches any character. Also this type of regular expression containing
a variable is the perfect example of when the "/o" flag optimization
is useful.
-- 
Andrew Langmead


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

Date: Fri, 27 Mar 1998 15:44:55 GMT
From: Clinton Bodine <Clinton.Bodine@mci.com>
To: brian d foy <comdog@computerdog.com>
Subject: Re: Help unpacking Little-Endian shorts and longs
Message-Id: <351BC8BB.18CED1F6@mci.com>

I had tried a couple of them, but didn't play with all of them.  It turns
out that n gives my the numbers I expect.  But aren't these values signed? 
What happens when my unsigned shorts and longs has a 1 in the "sign" bit? 
I won't get the results I expect, right?

brian d foy wrote:
> 
> In article <351AB312.10CA9891@mci.com>, Clinton Bodine <Clinton.Bodine@mci.com> posted:
> 
> >Hi All,
> >
> >I'm an a DEC Alpha running Digital Unix 4.0 and Perl 5.003.
> 
> have you played with the n,N and v,V templates for (un)pack?  the
> v,V templates seem to get their name from VAX (ta da!) :)
> 
> --
> brian d foy                                  <comdog@computerdog.com>
> CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
> Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
> Perl Mongers <URL:http://www.pm.org>

-- 
Clinton Bodine
Phone: (303) 390-6735
Vnet: 636-6735
Email: Clinton.Bodine@mci.com


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

Date: Fri, 27 Mar 1998 15:57:50 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: How do I create a reference to a specific mem loc?
Message-Id: <EqHJ0J.44K@world.std.com>

"Darren Carter" <dcarter@ch2m.com> writes:

>How can I create a reference (pointer) to a specific memory location?  In C
>(Borland flavour) I could use a macro called MK_FAR_PTR(segment,offset) to
>create a far pointer to a mem location.  I want to use a PERL script to read
>values from the parallel port (mem address 0x378) from a digital<->analog
>I/O card.

You are probably best off creating a small C library to do the actual
reading of the IO port, and use XS to link it to perl. Perl's scalars
take a few levels of indirection before they begin to look like an
integer in C, and the interpreter isn't suited to do this kind of
manipulation. See the perlxs and perlxstut man pages for
details. Also, your success will depend on what operating system you
use. A Windows based perl may have special tricks and traps for
building XS modules. A Unix based operating system will probably not
let a program directly access the I/O ports. (but probably will allow
you to read from the parallel port via /dev/lp1.)

A scalar in perl is kept a a struct in the perl interpreter (see the
perlguts man page for details. Or the really great "PerlGuts
Illustrated" at <URL:http://www.perl.com/CPAN/authors/Gisle_Aas/
illguts-0.05.tar.gz>) and a scalar holding an integer value has the
integer in the struct itself. (where in a string, the struct
representing the scalar is holding a pointer to a string allocated
elsewhere.) Even if you could instruct perl where to put the scalar,
mapping the struct onto an I/O region so that one field would match a
particular location would be scary. Whats even worse, is the fact that
the parallel port isn't on memory location 0x378, but I/O port
location 0x378. I/O addresses aren't accessed via normal memory access
machine instructions, but by special INP, OUTP instructions.
-- 
Andrew Langmead


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

Date: 27 Mar 1998 08:56:51 -0700
From: kjj@arf.eng.mcd.mot.com
Subject: Re: IMAP support?
Message-Id: <c0g90pwjfek.fsf@arf.eng.mcd.mot.com>

clint.harris@software.com (Clint Harris) writes:

> 	Does anyone have an IMAP module or script in perl?

I'll be releasing an alpha version of Net::IMAP next week.

-- 
thx,
kjj


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

Date: Fri, 27 Mar 1998 10:33:02 -0500
From: Rick Schofield <Richard.Schofield@fmr.com>
Subject: installing IO module on AIX
Message-Id: <351BC6AE.BBD8B528@fmr.com>

AIX 4.2 / perl 5.002

I'm trying to install the IO module IO-1.19 onto an AIX system v4.2 and
I'm gettting the
following errors in the "make test" phase:
"IO.c", line 272.42: 1506-099 (S) Unexpected argument"
"IO.c" line 574.9 1506-280 (W) Funcion argumentassignment betweem type
"struct cv*", and struct cv* is not allowed"

The first error points to this line:
    if( do_open(gv, "+>&", 3, FALSE, 0, 0, fp)) {

and the second:
   newXS("IO:Poll::_poll", XS_IO__Poll__poll, file);

Has anyone successfully installed this module to theis or similar
configuaration?

    Rick




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

Date: Fri, 27 Mar 1998 09:44:24 -0500
From: kpreid@ibm.net (Kevin Reid)
Subject: Re: Need sorting routine in Perl
Message-Id: <1d6hqyp.115dt7h7hksw0N@slip166-72-108-221.ny.us.ibm.net>

Amar Subramanian <amar@iss-gmbh.de> wrote:

> Gabor wrote:
> > 
> > In comp.lang.perl.misc, Didiek <didiek@intouch.co.id> wrote :
> > # Hi,
> > #
> > # Does anyone know how or where can I get a sample perl script for sorting
> > # numbers. I plan to build a link list and display them in a top referrer
> > # order basis. Just like top50 or top100 or whatever.
> > 
> > What's wrong with the built in 'sort'?
> > 
> i don't think there is an opportunity to use sort with a linked list, or
> is there any ? if ther is one please let me know.

Why would you want to use a linked list in Perl?

-- 
  Kevin Reid.      |         Macintosh.
   "I'm me."       |      Think different.


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

Date: 27 Mar 1998 14:45:25 GMT
From: Tom.Grydeland@phys.uit.no (Tom Grydeland)
Subject: Re: Odd dereferencing behavior
Message-Id: <slrn6hnes5.pk4.Tom.Grydeland@mitra.phys.uit.no>

On Thu, 26 Mar 1998 20:55:35 GMT,
Sean McAfee <mcafee@gorf.rs.itd.umich.edu> wrote:

> ...I get "test" printed to my terminal, as expected.  Every other variation
> I've tried (${shift @_}, ${my $x = shift}, etc) works correctly; only
> the simplest, ${shift}, doesn't.
> 
> My question can be summed up in one word:  Huh?

Because a single unquoted bareword inside the braces are interpreted as
a word, but because there is a possible ambiguity, Perl tells you
exactly how that is interpreted:

    % perl -wle 'print @{shift}'
    Ambiguous use of @{shift} resolved to @shift at -e line 1.

Why don't you let Perl help you? Use -w on your scripts!

> Sean McAfee | GS d->-- s+++: a25 C++ US+++$ P+++ L++ E- W+ N++ |

-- 
//Tom Grydeland <Tom.Grydeland@phys.uit.no>


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

Date: Fri, 27 Mar 1998 08:53:37 -0600
From: joshmccormack@yahoo.com
Subject: Re: Problems with handling Mac/PC/Unix line breaks
Message-Id: <6fgect$tlg$1@nnrp1.dejanews.com>

Save your scripts in a program like BBEdit or Pagespinner (I think). Under
BBedit save dialogue box choose options and change the line break option to
whatever you need.

Josh


In article <rmcassid-2503981450450001@dante.eng.uci.edu>,
  rmcassid@uci.edu (Robert Cassidy) wrote:
>
> Fairly newbie using MacPerl, but will likely have to deal with it on unix
> as well.
>
> I'm trying to figure out how to deal with files that have, without prior
> knowledge, Mac/DOS/unix line breaks. The problem is that some of the files
> I deal with run into the tens and hundreds of megabytes so just grabbing
> the whole file and looking for \n or \r is a wee bit impractical. I can
> make some safe assumptions about how many characters before a break should
> occur, though.
>
> -Bob Cassidy
>


-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 27 Mar 1998 08:23:04 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: dha@panix.com (David Adler)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <8cvht06tuv.fsf@gadget.cscaper.com>

>>>>> "David" == David Adler <dha@panix.com> writes:

David> On Wed, 25 Mar 1998 06:06:01 -0500, brian d foy <comdog@computerdog.com> wrote:
>> In article <6fai4r$prm$1@nnrp1.dejanews.com>, brian_r_parkes@hotmail.com posted:
>> 
>> perlilous - mucking with the internals or trying to understand Chip.

David> ... or trying to outdrink Randal.

Are you counting the full glasses or broken glasses?

:-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 158 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Fri, 27 Mar 1998 14:57:42 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: proposal: while $line (<FILE>)
Message-Id: <slrn6hnfgj.23a.jgloudon@manitoba.bbn.com>

Mike Stok <mike@stok.co.uk> wrote:
 .
 .
>
>  while (<FILE>) {
>    $line = $_;			# use $line instead of perl's
>				# usual default buffer, $_
>  }

Yes this is neater looking, but you end up having to use two variables
where one could have been all that was necessary, if it wasn't for the
"sparse" nature of the magic here :).

Obviously, in the case where you wanted to do something with $_, like a match, 
you'd end up using defined(). The magic needs to spread some more :).

-- 
Jason Gloudon


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

Date: Fri, 27 Mar 1998 10:02:22 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: proposal: while $line (<FILE>)
Message-Id: <351BBF7E.B87DDC96@shopcfn.com>

Mike Stok wrote:
> 
> In article <351B32F3.19B4B6B8@negia.net>,
> Dan Boorstein  <danboo@negia.net> wrote:
> >lately i've seen more and more mention of how:
> >
> >  while (<FILE>) # reads a solitary 0 from the last line
> >                 # (i.e., magic 'defined')
> >
> >differs from:
> >
> >  while ($line = <FILE>) # fails to read a solitary 0 from the last
> >                         # line (i.e., no magic 'defined')
> >
> 
> Please note that the code is different, there's an extra $line = in the
> second example.

uhhh, that's what i said. that's why i used the word *differs*
above. and if you note the comments to the right of the constructs
i demonstrate my understanding to be exactly what you copied from
perlop. this is a proposal for change, and necessarily at odds with
documented behavior.

> >  while $line (<FILE>)
> >
> >at the time i wasn't even aware of the magic going on in the
> >case of isolated <>'s within a 'while'. i was just looking for a
> >way to get my line reads into a scalar other than $_ (i was
> >big on being explicit at the time. i'm all better now :).
> 
>   while (<FILE>) {
>     $line = $_;                 # use $line instead of perl's
>                                 # usual default buffer, $_
>   }

i think you've missed my point. in your example above it's too late.
$_ is still being used, so you've got two copies of the same data and
you had to do an explicit copy to get there. note the differences below
using a 'foreach' example:

@foo = (1..10);

foreach my $i (@foo) { # alias supplied
  print $_;            # $_ not defined, using $i instead
}

foreach (@foo) {       # alias not supplied
  print $_;            # $_ defined
}

my suggestion was to make:

while $line (<FILE>)

perform similarly, in that $_ would be replaced by $line, but still
maintain the magic 'defined' test for <FILE>.

thanks,

-- 
danboo


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

Date: Fri, 27 Mar 1998 16:02:24 -0000
From: "Mike Lacey" <Mike_Lacey@Cargill.Com>
Subject: Re: psmulti & perl5
Message-Id: <6fgiim$2hd@wind.cargill.com>

bultman g.w. (aoct) wrote in message <351659CB.6C7C@rikz.rws.minvenw.nl>...
>I've recently deleted perl4 from our system (we only used it
>for psmulti, an application that prints postscript files n-up)
>Unfortunately, psmulti doesn't works with perl5_004

What is the error message or problem that you're getting?

Regards

Mike






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

Date: Fri, 27 Mar 1998 09:51:48 -0500
From: Bryan Beske <beske@worldnet.att.net>
Subject: Re: Redirect URL
Message-Id: <6fgefd$40a@bgtnsc03.worldnet.att.net>

If it is a simple, stactic page, issue the redirect:

    Location: http://....

If it is a little more complex, you could us the http module with
the "fetch" method to retrieve the page from the progam and then
dump it.

Drop me an e-mail if you would like an example of either method.

Bryan



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

Date: Fri, 27 Mar 1998 16:37:10 GMT
From: stephenb@scribendum.win-uk.net (stephen benson)
Subject: Re: Still a novice (getting older) still needing RegExpr help....
Message-Id: <351bcbb4.5281614@nntp.ibmpcug.co.uk>

On Fri, 27 Mar 1998 05:41:48 -0500, comdog@computerdog.com (brian d
foy) wrote:

>as for the HTML matching bits, you're missing the nifty HTML::Parser
>module, which, once you figure it out (not too tough, though), will
>give you the power of ten web whackers and free you from your regex
>fetish.

Thanks for the pointer; As to  HTML::Parser, I want to come out with a
clean, generalised vanilla regexp which could be used in a C or VB
program, a J*v*s**t script, or even a regexp supporting search/replace
program. My preference is just to run a Perl script on the fly to do
the conversion, but I have problems with server 'support' onsite.
Anyway, it's a good opportunity to learn something. And I still can't
work out why  /<strong>(WW Notes* to)\.*(\d*.*\d+)<\/strong>/s won't
match over newlines..
-- stephen benson
stephenb@scribendum.win-uk.net || stephen_benson@watsonwyatt.co.uk
http://www.ibmpcug.co.uk/~2i/ || http://www.scribendum.win-uk.net/
__________________________________________________________________


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

Date: Fri, 27 Mar 1998 15:32:22 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: ts: why have "push" and "unshift"?
Message-Id: <EqHHty.8L6@world.std.com>

tsatan@hotmail.com writes:

>One follow-up question: any ideas why the perl compiler doesn't
>optimize "@arr = ($x, @arr)" into "unshift @arr, $x"?
>Or am I the only perlson who would do something like that? ;-)

Its always seemed to me that one of the reasons that "there is more
than one way to do it" in perl is that certain idioms have performance
benefits. Where a compiler that stores its intermediate code may
programatically go through, detect certain sequences, and generate
different code, perl performance depends on the programmer choosing
different constructs, and tries to lead them to the proper choice by
thinking they are taking shortcuts.

For example, using boolean operators and statement modifiers to
express conditionals is not only more readable, as it is often said,
but it also avoids the overhead of entering and leaving a block. 

You also have things like grep and map that the user could implement
as a loop, but if used instead perform the entire operation in one
perl opcode, spending more time in the C code that the opcodes are
written in, and less time in the interpreter chasing down nodes in the
parse tree.

For the overhead of a block in a conditional statement, it seems that
later perl's do have an optimization that has been added. If use a
version of perl with debugging support enabled, and take a look at the
how perl runs the following scripts, you'll see a difference.

    perl -Dtls -e '$x=1;if($x){$y++}'
and 
    perl -Dtls -e '$x=1;$y++ if $x'

are almost identical, where

    perl -Dtls -e '$x=1;if($x){$y++;$z++}'
and 
    perl -Dtls -e '$x=1;$y++,$z++ if $x'

are significantly different. Another interesting thing is that the one
difference between the single variable increment versions of the
conditional block vs. the statement modifier is one "null"
opcode. This null opcode is in the same place that the two statement
if block does its "enter" opcode and starts its next block. I guess
the compiler initially emits an "enter block", but later when it sees
that there is no need for it, patches back in a null to replace it.

-- 
Andrew Langmead


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

Date: Fri, 27 Mar 1998 17:48:43 GMT
From: jallen10@wvu.edu (Jay Allen)
Subject: upgrade breakage?
Message-Id: <6fgeb5$8lc$1@cathedral.cerc.wvu.edu>

Hey,

Just wondering about something;  We are getting ready to upgrade our machines 
from Solaris 2.5 to Solaris 2.6.  (The machines are Sun, btw).  Would anyone 
happen to know if upgrading the OS will break my installations of PERL, or 
installations of Netscape Enterprise Server on those machines? I'd appreciate 
it if someone could warn me if they know of something that might break when 
upgrading like this - I need to get back to our other systems people quickly, 
and prepare to re-install stuff if need be when we upgrade, so I'd appreciate 
it if any replies could be e-mailed to me at: jallen10@wvu.edu .  Thanks!


//           Jay J. Allen
WVU AIS   -   ASAP
<jallen10@wvu.edu>


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

Date: Fri, 27 Mar 1998 17:06:01 +0300
From: "Alexander Petrosyan (PAF)" <paf@design.ru>
Subject: use Time::Local;  timelocal(, , , , , 1969) #year < EPOCH (1970)      HANGS UP
Message-Id: <6fgbm7$8qs$1@news.rinet.ru>

use Time::Local;

$Year = 1969;  # < EPOCH (1970)
timelocal(, , , , , $Year);

Hangs up inside of a Cheat sub.


What I think of standard modules is "they must have some sort of fool
proof"=="must not hang being passed wrong params"=="must return some kind of
error instead".

I inserted proper check but think someone might want to know about this +
fix that up in later releases...


[Maybe I sould mail this directly to Larry?  In that case would someone be
so kind as to provide me with valid email of him]

---
Alexander Petrosyan (PAF), Moscow.
email: paf@design.ru; paf@i-connect.ru
web: http://www.design.ru/paf
ICQ:10094069




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

Date: Fri, 27 Mar 1998 10:48:40 -0500
From: Rick Schofield <Richard.Schofield@fmr.com>
Subject: using ftp.pl as included in perl 5.002
Message-Id: <351BCA58.B6B5FF86@fmr.com>

I'm having some trouble using the bundled ftp piece under perl 5.002 on
an AIX 4.2 box.
First off, the require of socket.ph failed and I had to comment it out
and replace it with
a require of Socket.pm.  This seemed to work and I could then run the
attached checkout
program up to, but not including, the actual "get".  At that point, the
script returned with a
0 code from an ftp'expect call (that's right, the bundled ftp.pl is in
perl 4).

Has anyone been able to use this module recently.  I gather most folks
are using the FTP
stuff in libnet, and I'm working to get that installed in parallel with
this, but I'd also like to
find a way of getting the bundled ftp.pl to work too.  Any ideas?

    Rick



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

Date: Fri, 27 Mar 1998 14:21:24 GMT
From: you@somehost.somedomain (User)
Subject: Re: verifying email address -- how?
Message-Id: <351bb5bb.341982384@news.btinternet.com>

On Thu, 26 Mar 1998 13:36:41 -0700, NerveGas
<NerveGas@see_signature.com> wrote:

>> > could you provide a suggestion about how to verify the validity of
>> > an email address?
>> 
>> A. Don't bother trying.
>
>  But DO bother to check for shell escapes in their address, if your
>script will be working with system commands.  If you do something (very
>undesirable) like:
>
>system("cat temp.txt | mail $email_addr");
>
>then all the person has to do is put in the email address
>"noone@nobody.net;/bin/rm -r ~/*" .
>
>steve
>
>-- 
>
>----------------------------------------
>Domain name for replying is "inconnect".
>----------------------------------------
I like it !

All those poor spammers..:->


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

Date: 27 Mar 1998 08:35:15 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: NerveGas@inconnect.com
Subject: Re: verifying email address -- how?
Message-Id: <8cra3o6tak.fsf@gadget.cscaper.com>

>>>>> "NerveGas" == NerveGas  <NerveGas@see_signature.com> writes:

NerveGas>   But DO bother to check for shell escapes in their address,
NerveGas> if your script will be working with system commands.

No.  Some *valid* email addresses have things in them that you would
call "shell escapes".

NerveGas>   If you
NerveGas> do something (very undesirable) like:

NerveGas> system("cat temp.txt | mail $email_addr");

NerveGas> then all the person has to do is put in the email address
NerveGas> "noone@nobody.net;/bin/rm -r ~/*" .

Right.  So don't do that.  You *never* have to hand an email address
to the shell.  Read the Web Security FAQ.  Attend one of my Perl
Security lectures.  There are *ways* to do it *right*.

(And that's a useless use of Cat, by the way. :-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 158 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 27 Mar 1998 09:18:13 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: csscook@mailbox.uq.edu.au (Steven John Cook)
Subject: Re: What is a JAPH
Message-Id: <8cn2ec6ray.fsf@gadget.cscaper.com>

>>>>> "Steven" == Steven John Cook <csscook@mailbox.uq.edu.au> writes:

Steven> I am trying to move from a User to Expert in the 'Seven Levels
Steven> of Perl Mastery' and one of the only things left for me to do
Steven> is write a JAPH. The only problem is I don't even know what
Steven> JAPH stands for, so I can't write one. Can a current Perl
Steven> expert or higher enlighten me.

Those who know, don't tell.

Those who tell, don't know.

:-)

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 157 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 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.

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

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