[8376] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1993 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 28 15:07:51 1998

Date: Sat, 28 Feb 98 12: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           Sat, 28 Feb 1998     Volume: 8 Number: 1993

Today's topics:
        "Learning Perl" or "Programming Perl" (Benjamin Smith)
    Re: "require" probs... <jefpin@bergen.org>
    Re: "require" probs... <tjbiuso@redrose.net>
        About QUERY_STRING <James@jwtech.net>
        answers (was Re: stumper: fun with perl) <danboo@negia.net>
        Compile problem with PERL54 <cyberman@sonoma.edu>
    Re: Compile problem with PERL54 <meconlen@intnet.net>
    Re: Does Registry.pm work on Win95' ??? (Marc Haber)
        Form-to-EMail <tmaufr@highsierra.NOSPAM.com>
        Help with kill() on NT, again. <kehoe@fc.hp.com>
    Re: How to read a directory listing into an array? (Michael J. Collins)
    Re: Killfile Triage (fwd) <meconlen@intnet.net>
    Re: Killfile Triage (peter caffin)
    Re: Modeling Data Structures in Perl <tchrist@mox.perl.com>
        Q: splice() time complexity, want linked lists? (David Petrou)
    Re: Q: splice() time complexity, want linked lists? (David Petrou)
        Q: using a c-lib with char** and even char*** <stefan.geissler@metronet.de>
        Slurping Strings <meconlen@intnet.net>
    Re: stumper: fun with perl <rjk@coos.dartmouth.edu>
    Re: The Ineffable Tom C. <meconlen@intnet.net>
    Re: The Ineffable Tom C. (John)
        Trapping Domain (or IP) of user who 'Clicks' on a Link. (Mr. Roboto)
    Re: What does this one-liner do? <boys@aspentech.com>
    Re: What does this one-liner do? <merlyn@stonehenge.com>
    Re: What does this one-liner do? <meconlen@intnet.net>
    Re: What does this one-liner do? <rjk@coos.dartmouth.edu>
    Re: Year 2000 <danboo@negia.net>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sat, 28 Feb 1998 12:39:47 -0600
From: benbean@yahoo.com-*nospam*- (Benjamin Smith)
Subject: "Learning Perl" or "Programming Perl"
Message-Id: <MPG.f6215f3d2e27cd2989680@news.ionet.net>

Hi,

I'm trying to get started with Perl and I'd like to purchase a book
from those fine people at O'Reilly but minimize my initial expenses by
only getting one. My question is "Learning Perl" or "Programming
Perl"?

They both cover a lot of material. Is there much overlap between the
two? Do they complement each other or offer different things? Is
"Programming Perl" more advanced, or does it too start from scratch?

I'm a Windows developer familiar with C, C++, Pascal and all sorts of
OSs and major and minor languages so I don't need to be completely
hand-held... I need a quick introduction to bring me up to speed.

Any thoughts would be appreciated.


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

Date: Sat, 28 Feb 1998 11:12:18 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Randall Stephenson <tjbtech@rtweb.net>
Subject: Re: "require" probs...
Message-Id: <Pine.SGI.3.95.980228111043.17424B-100000@vangogh.bergen.org>

>[name of required script] does not return true in [name of script] line
>[#]

Ah.  That means that there is no 1; at the end of the script your
'require'ing.  It needs to return a true value at then end of it, and you
script may not do that currently.  This will NOT effect the 'require'd
script at all, just allow it to be 'require'd.

--
| I am NOT a mother!
|                                               - Jennifer Pinyan

    Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
             techmaster@bergen.org | techmaster@mindless.com
                qw[jeff] on #perl,#javascript,#cgi on IRC

 &jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}



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

Date: Sat, 28 Feb 1998 11:37:46 -0500
From: Tom Biuso <tjbiuso@redrose.net>
To: Bob Trieger <corky@ma.ultranet.com>, jeffpin@bergen.org, palincss@nicom.com
Subject: Re: "require" probs...
Message-Id: <34F83D59.15B0DF@redrose.net>

Bob Trieger wrote:

> Randall Stephenson wrote:
> >
> > I am using another script as a library for some subs.  Obviously,
> this
> > requires (no pun intended) the "require" function.  Isn't the
> permission
> > for a required script 744?  Nevertheless, I have tried every
> permission,
> > but to no avail.  I get this strange message:
> >
> > [name of required script] does not return true in [name of script]
> line
> > [#]
>
> Try putting
>
> 1;
>
> as the last line in the script you are using as a library to make it
> return true.
>
> HTH
> Bob Trieger
> corky@ultranet.com


Thank you to all those who have helped me.



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

Date: Sat, 28 Feb 1998 23:10:56 +0800
From: "Jamis" <James@jwtech.net>
Subject: About QUERY_STRING
Message-Id: <34F82900.40B92A83@jwtech.net>


--------------0EF2F130CFB13081AB15B312
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi ;
      All-
I have something to ask you guy, i am using Omnihttp 1.01 for win95
server but the httpd
do not support {query_string} can someone help me, if i do not want the
$ENV{QUERY_STRING}"; can i replace something like $ENV{OPEN}";
  ------------------------------------------------------------------------

$CGIurl = "$script_url?"."$ENV{QUERY_STRING}";
$forum_link = "$forum_dir"."$ENV{QUERY_STRING}".".asp";
$forum_link_url = "$forum_dir_url"."$ENV{QUERY_STRING}".".asp";
  ------------------------------------------------------------------------

James

--------------0EF2F130CFB13081AB15B312
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
Hi ;
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; All-
<BR>I have something to ask you guy, i am using Omnihttp 1.01 for win95
server but the httpd
<BR>do not support {query_string} can someone help me, if i do not want
the $ENV{QUERY_STRING}"; can i replace something like $ENV{OPEN}";
<BR>
<HR ALIGN=LEFT SIZE=1 WIDTH="100%">
<BR>$CGIurl = "$script_url?"."$ENV{QUERY_STRING}";
<BR>$forum_link = "$forum_dir"."$ENV{QUERY_STRING}".".asp";
<BR>$forum_link_url = "$forum_dir_url"."$ENV{QUERY_STRING}".".asp";
<BR>
<HR ALIGN=LEFT SIZE=1 WIDTH="100%">
<BR>James</HTML>

--------------0EF2F130CFB13081AB15B312--



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

Date: Sat, 28 Feb 1998 10:44:16 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: answers (was Re: stumper: fun with perl)
Message-Id: <34F830D0.3F42E369@negia.net>

and the winner is . . . well, nobody. it wasn't a contest. anyway,
here's the ideas presented thus far, as well as mine.

from: jdf@pobox.com (Jonathan Feinberg)
> Well, there's always the faq:

print (-t STDIN and -t STDOUT) ? "foo\n" : "bar\n";

ahh, i forgot about that one. though i think this example has some
associativity problems, i get the idea.

from: John Porter <jdporter@min.net>
> When run from a file, the string contains literally a one character
> and a backspace character. This evaluates to non-false, so 'bar'
> gets printed. If you type this in a typically tty, your backspace
> erases the one character and string is empty, evaluating to false,
> printing 'foo'.

$i = '1^H';
print $i ? 'bar' : 'foo';

very clever, but it may violate the rule about the text of the scripts
being the same. though the keystrokes are identical, on my terminal
the 1 gets deleted right away.

from: Uri Guttman <uri@sysarch.com>
> do i get a prize?

print ( -t STDIN ? "foo\n" : "bar\n" ) ;

same idea as the first but with appropriate parens. sorry Uri, as
stated in the official sweepstakes entry form, the only potential
prize is personal satisfaction. :)

from: me <danboo@negia.net>

#bar
seek DATA,0,0;
($_=<DATA>)=~s/#//;
print;
__END__
foo

to be honest, i never expected this behavior, i just stumbled across
it while playing around with my first JAPH (see below). i searched
the docs, faqs and news archives but found no mention of it.

well, thank you for playing along. i hope somebody learned something.

-- 
#!/usr/bin/perl -w -- 2 for 1    dan boorstein <dboorstein@shopcfn.com>
# my first Just another Perl hacker,
seek DATA,0,0;{$_=<DATA>,/!/&&redo}print join(' ',(split)[3..6])__END__
# my second Just another Perl hacker,


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

Date: Sat, 28 Feb 1998 08:38:16 -0800
From: "David C. McCall" <cyberman@sonoma.edu>
Subject: Compile problem with PERL54
Message-Id: <34F83D78.6832537E@sonoma.edu>

Anyone know what's going on below?  any help would be appreciated.
SunOS4.1.3....error is genereated with gcc and cc.......thanks ahead of
time

rm -f libperl.a
ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o
dump.o util.
o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
doop.o doio.
o regexec.o taint.o deb.o universal.o globals.o perlio.o
gcc  -L/usr/local/lib -o miniperl miniperlmain.o libperl.a
ld: Undefined symbol
   ___infinity
   _cos
   _atan2
   _sqrt
   _sin
   _floor
   _exp
   _log
   _pow
collect2: ld returned 2 exit status
*** Error code 1
make: Fatal error: Command failed for target `miniperl'



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

Date: Sat, 28 Feb 1998 15:03:56 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Re: Compile problem with PERL54
Message-Id: <Pine.LNX.3.95.980228150223.9550E-100000@baby.obfuscated.net>

On Sat, 28 Feb 1998, David C. McCall wrote:

> Anyone know what's going on below?  any help would be appreciated.
> SunOS4.1.3....error is genereated with gcc and cc.......thanks ahead of
> time

You are not including libm.a in your compile... see below!

> rm -f libperl.a
> ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o
> dump.o util.
> o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
> doop.o doio.
> o regexec.o taint.o deb.o universal.o globals.o perlio.o
> gcc  -L/usr/local/lib -o miniperl miniperlmain.o libperl.a
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You should place a -lm, probably at the end of the line, such as

gcc -L/usr/local/lib -o minperl minperlmain.o libperl.a -lm

> ld: Undefined symbol
>    ___infinity
>    _cos
>    _atan2
>    _sqrt
>    _sin
>    _floor
>    _exp
>    _log
>    _pow
> collect2: ld returned 2 exit status
> *** Error code 1
> make: Fatal error: Command failed for target `miniperl'


Michael Conlen
meconlen@intnet.net




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

Date: Sat, 28 Feb 1998 18:05:57 GMT
From: Marc.Haber-usenet@gmx.de (Marc Haber)
Subject: Re: Does Registry.pm work on Win95' ???
Message-Id: <6d9jmc$shk$1@nz12.rz.uni-karlsruhe.de>

qvanegeren@frxsoft.com wrote:
>I am attempting to use the Registry.pm file to read some values
>from my Win 95 registry.  Does this module work correctly under
>Win 95 or does it only work on WinNT?

The Registry module works fine under Windows 95.

Greetings
Marc

-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber          |   " Questions are the         | Mailadresse im Header
Karlsruhe, Germany  |     Beginning of Wisdom "     | Fon: *49 721 966 32 15
Nordisch by Nature  | Lt. Worf, TNG "Rightful Heir" | Fax: *49 721 966 31 29


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

Date: Sat, 28 Feb 1998 11:16:18 -0800
From: "M. Kay Aufrance" <tmaufr@highsierra.NOSPAM.com>
Subject: Form-to-EMail
Message-Id: <34F86282.6565@highsierra.com>

For the many who are asking about email forms processing in perl
Form-to-EMail for Windows NT is at http://www.aufrance.com

We include not only the source but also complete instructions and
customer support.

M. Kay
Aufrance Associates
Software for Web servers on Windows NT / 95
P.O. Box 19338
South Lake Tahoe, CA 96151
tmaufr@highsierra.com
(530) 577-5709


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

Date: Sat, 28 Feb 1998 12:34:33 -0700
From: "Jeffrey W. Kehoe" <kehoe@fc.hp.com>
Subject: Help with kill() on NT, again.
Message-Id: <34F866C9.340A7E82@fc.hp.com>

I'm porting some perl code from Unix to NT.  The code spawns off some
other processes, storing the PIDs in a file, then exits.  Another perl
script comes along later, reads the PIDs, then kills the processes with
kill().

All the documentation I've found says that this shouldn't work on NT.
But I found that if I change the signal from SIGKILL to SIGTERM, it does
indeed kill the processes.  The call to kill() doesn't return the number
of processes killed as it is supposed to, but it seems to work
otherwise.

Can anyone explain why this works?  Is it safe to use, or should I write
my own tool that uses OpenProcess & TerminateProcess?



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

Date: Sat, 28 Feb 1998 16:49:49 GMT
From: mike@w3z.com (Michael J. Collins)
Subject: Re: How to read a directory listing into an array?
Message-Id: <34fa3f57.2137693@news.tiac.net>

On Sat, 28 Feb 1998 14:58:24 -0500, Ray Reza
<rayreza@worldnet.att.net> wrote:

>opendir(Dir,"C:\") || Cgidie("Can not opne directory");
>while (defined($filename = readdir(Dir))) {
># iterated through the files in dir C:\
> }
>closedir(Dir);
>This code work on NT 4.0 i donot know if it will work

>Alex wrote:
>> How can I do this? I just need to get a dir listing into an array of
>> strings....seems simple but Im stumped... :( any help?

sub clean{
#################
# CLEAR TEMP FILE
#################
opendir(DIR, "d:/_web/cgi/temp") || warn "Temp dir empty: $! \n";
my @filelist = readdir (DIR);
closedir (@filelist);
shift (@filelist) if ("$filelist[0]" == ""); #get rid of dots
shift (@filelist) if ("$filelist[0]" == "");
for $eachfile (@filelist) # An example
{
unlink "d:/_web/cgi/temp/$eachfile";
print "\."; # progress indicator
}
}
1




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

Date: Sat, 28 Feb 1998 13:44:15 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Re: Killfile Triage (fwd)
Message-Id: <Pine.LNX.3.95.980228134403.8912E-100000@baby.obfuscated.net>



---------- Forwarded message ----------
Date: Sat, 28 Feb 1998 13:43:05 -0500
From: Michael Conlen <meconlen@intnet.net>
Newsgroups: news.software.readers
Subject: Re: Killfile Triage

On 27 Feb 1998, Sven Guckes wrote:

> psamuels@sampo.REMOVETHIS.creighton.edu (Peter Samuelson):
> > Most people do something semi-obvious to the address itself, rather than
> > outright replace it.  [...] it's usually obvious enough from the address
> > itself.  [...] should take all of, say, five seconds to spot the average
> > spam-mangled address
> 
> Now, what would happen if everyone just used a valid address?
> Noone would have to scan the complete article for clues.
> No loss of time.  Just followup/reply.  What a concept.
> 
> I hope that JED will add some code or macros to slrn
> which will warn me about "nospam" address of posters
> so I can abort my response right away.
> I really dont want to waste any time on people
> who make it clear that they do not want replies.
> 
> How did comp.lang.perl.misc get into this?
> Note: Followup-To: news.software.readers

You know, I have a little package written in perl for just this type of
thing. Its a very beta module called Mail::Filter (which I would like to
get on to CPAN, but I'm not sure where to begin with that, hint, hint). In
any case if your on a UNIX box, and your mail gets processed with procmail
I have a program called filter.pl, distributed with the very beta
Mail::Filter module which when placed in a .forward like so...
|/home/meconlen/bin/filter.pl

filters your mail in to a file which you specify with a simple line in
a file called .mfrc in your home directory. An example of this is

Filter:Subject\072 .*cash:/dev/null

This is listed after all my personal mail filters, so that nothing
personal gets accidentaly deleted. The module splits on :, so I had to use
\072 instead of :. If your intrested email me. With this little package
you can create filters which take full use of perl's regular expression
engine to dump unwanted mail to the great bit bucket in the sky and remote
 .nospam from the end of your email addresses! Additional benifits include
being able to seperate out all your email from your high volume mailing
lists, your friends, ect. I've never had any problems with this at all in
the week of testing it. 

I should note that this will require you to patch up the source a bit
beacuse I havent gotten a configure package together yet. As this is very
beta it creates a debugging output with the entire contents of the email
messages so you can see where something might hvae gone wrong. This will
also help if something gets deleted accidently to /dev/null. 

Michael Conlen
meconlen@intnet.net




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

Date: Sat, 28 Feb 1998 13:46:00 GMT
From: nospam_synic@omen.net.au (peter caffin)
Subject: Re: Killfile Triage
Message-Id: <34fa14e9.1950617@news.omen.net.au>

jbritain@home.com (Jim Britain) did cunningly address to comp.lang.perl.misc..
:On Wed, 25 Feb 1998 04:49:42 GMT, nospam_synic@omen.net.au (peter
:caffin) wrote:
:>I simply do not see what the fuss is about. Sighting nospam_ masks in From:
:>headers during a reply is trivial (unless you happen to be writing a 
:>spam-bot which does your replying for you).
:>
:No deal from me on that one (reading to the end of the text)  I answer
:upwards of 100 help messages a day.  Quite simply, if a user does not
:have a valid address in his message header, he does not get a
:response.  I just don't have time to look for "special instructions"
:to readdress a message.

Who'd use a nospam_ type mask their From: for an email message? Doing that
just seems twitty :-).

--:     _         ___  _    _ _ 
 _oo__ |_|_ |__  _ |  |  _ |_|_' _        mailto:synic@omen.net.au
//`'\_ | (/_|(/_| .|. |_(_|| | || |  http://www.omen.net.au/~synic
/ 


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

Date: 28 Feb 1998 19:31:30 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Modeling Data Structures in Perl
Message-Id: <6d9omi$du8$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, sspiegle@crcg.edu writes:

:I'm a newbie perl programmer with a question. 

What would you like to wager that your question has been asked before?
What would you like to wager that your question is in the Perl FAQ?

:So, is there a way, using perl, to create a data stucture-type variable
:and then create multiple instances of this whenever a new student
:is needed?

The answer is contained on your very own system within the over
1,000 searchable pages of documentation shipped with each and every
Perl distribution.  It is accessible there in much better time than
posting something to Usenet.  You'll find that this is covered in the
standard perlfaq7 manpage under "How do I declare/create a structure?"
That answer will in turn direct you to the standard perldsc and perltoot
manpages, amongst others.

Here are two tips, though, that will get you started:

    1) 	When you want a list, a tuple, a vector, a stack, or a queue, 
	look into using a Perl *ARRAY*.

    2) 	When you want a set, a table, a relation, a struct, or a record, 
	look into using a Perl *HASH*.

If you don't have docs, you don't have Perl.  Please read them.

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


"All things are possible, but not all expedient."  (in life, UNIX, and perl) -me


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

Date: 28 Feb 1998 17:45:03 GMT
From: dpetrou@cs.cmu.edu (David Petrou)
Subject: Q: splice() time complexity, want linked lists?
Message-Id: <6d9iev$77u$1@goldenapple.srv.cs.cmu.edu>

Hi.  Let's say I have an array and want to remove an element in the
middle, moving all the remaining elements up to fill the hole.  It
appears that I can do this with split(), but I'm a bit worried about
how long it takes to do this.  I'll be using this operation in an LRU
stack-depth analysis tool dealing with millions of elements.

What I really want is a data structure that let's me do head insertion
O(1), removal of any element in any location O(1), and traversal in
O(n), where n is the number of elements in the structure.  In other
words, I want a singly-linked list.  Am I unnaturally trying to get
linked list performance from arrays?

What's the perl way (or _one_ of the ways to do it in perl)?

Thanks,
David


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

Date: 28 Feb 1998 19:25:23 GMT
From: dpetrou@cs.cmu.edu (David Petrou)
Subject: Re: Q: splice() time complexity, want linked lists?
Message-Id: <6d9ob3$a74$1@goldenapple.srv.cs.cmu.edu>

David Petrou (dpetrou@cs.cmu.edu) wrote:
: What I really want is a data structure that let's me do head insertion
: O(1), removal of any element in any location O(1), and traversal in
: O(n), where n is the number of elements in the structure.  In other
: words, I want a singly-linked list.

Gerr.  Obviously I meant "doubly-linked" list.  (Since you can't
remove an arbitrary element in O(1) using singly-linked lists.)

: Thanks,
: David

No, thank you!
David


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

Date: Sat, 28 Feb 1998 20:56:58 +0100
From: Stefan Geissler <stefan.geissler@metronet.de>
Subject: Q: using a c-lib with char** and even char***
Message-Id: <34F86C0A.1929@metronet.de>

Hi perl-community,

I'm dreaming of using a c-library directly from Perl that 
uses functions with char** and char*** arguments.

>From what I've read in the SWIG and XS documentation this is not
trivial and might require some quite internal coding.

I assume cases like this are not uncommon. What does the not so
professional Perl-user do here? Is there a tool somewhere that
lets me include more or less any C-library and call it from
Perl?

Any help is welcome. Thanks in advance,
--stefan

-- 
# Stefan Geissler, stefan.geissler@metronet.de  #
# Saarstr 29. D-69151 Neckargemuend, 06223/2451 #


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

Date: Sat, 28 Feb 1998 14:22:09 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Slurping Strings
Message-Id: <Pine.LNX.3.95.980228141433.9550A-100000@baby.obfuscated.net>

if I say

$string = "\072"; 

$string will equal ":"

however if I say

open MFRC, $RC or open MFRC, ".mfrc" or die "Can not open $RC\n";
chomp;
$string = $_;

and the line it read from the file is

Filter:Subject\072 Perl:Perl

then $string will be equal to "Filter:Subject\072 Perl:Perl", not
"Filter:Subject: Perl:Perl". This is actualy a very handy feature, because
now I can

@line = split /:/, $string;

Now what I would like to do is convert line[1] from being equal to
"Subject\072 Perl" to being equal to "Subject: Perl". Currently I am
passing the string to a function which splits on white space, then on \0,
and if found converts the number to the character. This is a bit
cumbersome, and the code looks like something the C++at dragged in. Any
suguestions on a better way to perform this conversion?

Michael Conlen
meconlen@intnet.net





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

Date: Sat, 28 Feb 1998 14:22:10 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: stumper: fun with perl
Message-Id: <34F863E5.BD3CF38B@coos.dartmouth.edu>

Uri Guttman wrote:
> 
> you should add no -t since this works fine:
> 
> print ( -t STDIN ? "foo\n" : "bar\n" ) ;
> 
> > cat foo4.pl
> #!/usr/local/bin/perl
> print ( -t STDIN ? "foo\n" : "bar\n" ) ;
> You have mail in /var/mail/uri
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Bare word found where operator expected at - line 3, near "/var/mail"
        (Missing operator before ail?)
syntax error at - line 3, near "/var/mail"
Execution of - aborted due to compilation errors.

:-)

> > perl < foo4.pl
> bar
> > perl foo4.pl
> foo
> >
> 
> do i get a prize?

No, but you do have mail.  ;-)

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


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

Date: Sat, 28 Feb 1998 13:59:55 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Re: The Ineffable Tom C.
Message-Id: <Pine.LNX.3.95.980228135301.8912G-100000@baby.obfuscated.net>

On 27 Feb 1998, Brian Altheim wrote:

> Or maybe there's just a lotta people out there with poor Netiquette.

I thought that died with the birth of Netscape and the flat rate PPP!?

I have found recently that the ammount of information is becomming so
great that it becomes dificult to know where to start. My documentation
from the start has been the camel book, and the existance of perldoc was
unknown to me untill I started reading this news group. If there's a faq
on perl programming its self its unknown to me (the camel book?). What
online resources are out there? perl.org, perl.com,
my.web.site.about.perl.com/who/knows/what???

I have always felt the best way to handle a often asked question is a FAQ,
which will be referenced when people ask questions answered there.
Anything basic which is documented in any other resource should be
referenced when someone asks, ie.

see Camel book, Chapter 2... ...or possibly even just 
see Camel book.

To answer the question outright will result in more of the same. To say,
rtfm, these days will result in people dying in a sea of knowledge, unless
you can help them find the manual you are refering to

Michael Conlen




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

Date: 28 Feb 1998 18:18:07 GMT
From: falstaff@lennon.postino.com (John)
Subject: Re: The Ineffable Tom C.
Message-Id: <6d9kcv$7b5$1@lennon.postino.com>

X-Newsreader: TIN [version 1.2 PL2]

Joseph N. Hall (joseph@5sigma.com) wrote:
: However, there is a danger of scaring away *customers*, both
: clients for our training classes and buyers of my book, so I
: personally try not to be a jerk.  I may be nitpicky and semi-
: intolerant but hopefully not a complete hoser.  Of course there 
: are those times when I lose it, but I hope those aren't that 
: frequent.

: Peter Samuelson wrote:
: > There is not, repeat, *not* a danger of scaring away potential Perl
: > programmers/developers. [...]

And on this point Tom _has_ lost income. I am the Perl guru at
work and many people come to me with questions. I suggest different
books, but _always_ warn people to stay away from "Learning Perl
on Win32", which is co-authored by Tom C. Tom has posted slams on
NT and Win32, or posted his kill-file list that includes anything to
do with Win32. For him to try and profit from Win32 is a dictionary
definition of Hypocracy. 

Falstaff  


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

Date: Sat, 28 Feb 1998 15:22:28 GMT
From: Mr.Roboto@Kilroy.was.here (Mr. Roboto)
Subject: Trapping Domain (or IP) of user who 'Clicks' on a Link...
Message-Id: <34f82928.4939511@news.granis.net>

Anyone have a simple script handy that can trap the Domain (preferred)
or IP of a user who 'Clicks' on a link (either text or graphic)?  I
have a Unique, Free game on the net and get over 60,000 pagehits a
month now.  The hosting of my site has been traded for a link to the
company on each page and I am looking for a quick way to put the link
in a script that would trap the Domain or IP of anyone who clicks on
the link so I can feed that back to my host.  (They are not tracking
it on their end.)

The reason?  Since they are tracking any click-throughs from my site,
they won't see any benefit of hosting me unless I can send them a list
of people who clicked though.  I know I probably won't get complete
user info but at least the Domain would help since they can then look
at new business for that week/month and correlate the matching
Domains...

Thanks for any help guys (and gals)!
Matt
voltec@granis.net

Voltec's 1-On-1 Free Basketball Game
http://voltec.springweb.com/



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

Date: Fri, 27 Feb 1998 18:58:38 +0000
From: Ian Boys <boys@aspentech.com>
Subject: Re: What does this one-liner do?
Message-Id: <34F70CDE.52BF@aspentech.com>

[courtesy cc sent to author]

Mark Conty wrote:
> 
> Eike Grote wrote:
> [...]
> |>
> |>   "List assignment in a scalar context returns the number of
> |>    elements produced by the expression on the right side of the
> |>    assignment: ..."
> 
> ... but the expression "$x = ( ($a) = ... )" is evaluating a list that
> is _one_ element long, not three!  After all, $a is a scalar, not a
> list.
> 
> Now I'm puzzled too...  *sigh*

I think you have puzzled yourself by deleting the (7,8,9) in the
original code example.

It was:  print ( $x = ( ($a) = (7,8,9) ) );

Look again at the quote above:

  "List assignment in a scalar context returns the number of 
   elements produced by the expression on the right side of the
   assignment: ..."

The list assignment is ($a) = (7,8,9).

Now the expression on the right hand side of the list assignment is 
(7,8,9), producing 3 elements to be assigned.  Therefore $x gets a 3.

It doesn't matter how Perl goes about assigning three elements to ($a),
since this is on the left hand side, and the LHS was not mentioned 
anywhere in the explanation of the behaviour.

Ian


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

Date: 28 Feb 1998 10:01:09 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: jdporter@min.net
Subject: Re: What does this one-liner do?
Message-Id: <8cogzr1x62.fsf@gadget.cscaper.com>

>>>>> "John" == John Porter <jdporter@min.net> writes:

John> Context, as Greg said, is "fun".  Array assignment in a scalar
John> context is not the same as an array expression in a scalar context.

Agreed, only because that last item "array expression in a scalar context"
*does not exist*.

There's NO SUCH THING as an "array expression" in a "scalar context".
Cannot happen.  (There's not even really anything like a "scalar
expression" either, but I'll leave that rant for another post. :-)

Unless you are calling "@foo" an "array expression".  I'd call that
"an array variable name".  Which in a scalar context is the number of
elements of @foo, yes.  But "@foo[@bar]" (an array slice) returns the
last element of the slice in a scalar context.  And "sort @foo" (a
sort of an array :-) returns undef in a scalar context.  None of those
are "array expressions"... a meaningless term that doesn't map into
anything in Perl.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,990.69 collected, $186,159.85 spent; just 184 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: Sat, 28 Feb 1998 13:50:23 -0500
From: Michael Conlen <meconlen@intnet.net>
Subject: Re: What does this one-liner do?
Message-Id: <Pine.LNX.3.95.980228134736.8912F-100000@baby.obfuscated.net>

On Fri, 27 Feb 1998, Eike Grote wrote:

> Hi,
> 
> Olav Reinert wrote:
> > 
> > Another guy trying to learn Perl, and I'm having trouble understanding what
> > the return value of the assignment operator is. Consider this statement:
> > 
> > print ( $x = ($a) = (7,8,9) );
> 
> First point to mention: associativity of '=' is "right" which
> means that the above is equivalent to
> 
>   print ( $x = ( ($a) = (7,8,9) ) );
> 
> The reason why the value of '$x' is equal to '3' afterwards can be
> found in the "Camel", 2nd ed., p.48:
> 
>   "List assignment in a scalar context returns the number of
>    elements produced by the expression on the right side of the
>    assignment: ..."

I found that, and belived that to be the reason in the first place, and it
probably is in any case, however what puzzles me is why $a will be 7 while
$x is 3. using ($a) puts $a in to list context, so it will be equal to the
first element of (7,8,9), which I have found true by testing. Does ($a)
retain some part of the list (7,8,9) which says that ($a) is a list of
three elements? My original guess was that $x would be = to 1, ie. the
scalar context return of a list with one element

Michael Conlen




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

Date: Sat, 28 Feb 1998 14:36:21 -0500
From: Chipmunk <rjk@coos.dartmouth.edu>
Subject: Re: What does this one-liner do?
Message-Id: <34F86738.B60AFD8C@coos.dartmouth.edu>

Mark Conty wrote:
> 
> That, or the man page should be changed to read something like:
> 
>         Array assignment in a scalar context returns the number of
>         elements produced by the _scalar_ evaluation of the
>         _rightmost_* expression of the assignment: [emphasis added]
> 
>         (* ... or should that read _innermost_?)

Neither.  An assignment only has TWO expressions, so saying "rightmost" is
just silly.  And the number of elements in the scalar evaluation of (7,8,9)
would be 1, not 3, so that addition would be incorrect too.

The reason you're confused is that:

$x = ($a) = (7,8,9);

Is composed of two assignments.

One is '($a) = (7,8,9)'.  The LHS is '($a)' and the RHS is '(7,8,9)'.

Because that expression is being assigned to a scalar variable, it is being
evaluated in a scalar context.  There are 3 elements in the RHS, so the
expression '($a) = (7,8,9)' returns the value 3.

The second assignment is '$x = ($a) = (7,8,9)'.  The LHS is '$x', and the RHS
is '($a) = (7,8,9)'.

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


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

Date: Sat, 28 Feb 1998 09:59:37 -0500
From: Dan Boorstein <danboo@negia.net>
Subject: Re: Year 2000
Message-Id: <34F82659.27EB1ECD@negia.net>

A. Maxwell wrote:
> 
> I am using then following piece of code to generate the time and date.
> 
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
> $date_now =  "$mday/$mon/$year";
> $time_now = "$hour\:$min\:$sec";
> 
> The time function returns the number of non-leap seconds since January
> 1, 1970, what will happen in the year 2000 .  As far as I know the year
> has 1900 subtracted from it. Therefore I assume that the year will be
> displayed as 00 for 2000, 01 for 2001 etc.
> 

if you suspect that $year is going to be the year minus 1900, why would
you expect it to be 00 in 2000? here's a perl program to demonstrate :)

#!/usr/bin/perl -w
use strict;
print 2000 - 1900;

and you may want to take a look at $mon as well. your never going to see
december like that.

cheers,

-- 
dan boorstein


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

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

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