[11638] in Perl-Users-Digest
Perl-Users Digest, Issue: 5238 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 27 04:02:26 1999
Date: Sat, 27 Mar 99 01:00:20 -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, 27 Mar 1999 Volume: 8 Number: 5238
Today's topics:
Re: $alreadyHaveError parameter problem (Ronald J Kimball)
Re: [AJM] Need assistance with sockets and Perl (Murphy)
Re: anything like xemacs for win32? <hattons@cpkwebser5.ncr.disa.mil>
Compiling Perl Scripts <petes@hempseed.com>
Re: Counter Digits <petes@hempseed.com>
Re: Easy ?... why doesn't this script run on NT?... Tha (rogerDH)
Re: Easy ?... why doesn't this script run on NT? (Bill Moseley)
HELP HELP HELP HELP HELP salbarcar@my-dejanews.com
Help! How scanf() in Perl? (Les Neste)
Making Perl work with Netscape / IE <petes@hempseed.com>
Need help with WIN32::GUI <leblondrp.m@worldnet.att.net>
Passing a reference to a subroutine to another subrouti <netlist-usa@worldnet.att.net>
Re: Passing a reference to a subroutine to another subr <jdf@pobox.com>
Re: Perl Composer Needed <leblondrp.m@worldnet.att.net>
Re: regular expression (Ronald J Kimball)
Re: script headers <petes@hempseed.com>
Sending a cookie to a server with a perl script zimdog@netscape.net
Re: SIGPIPE and SIGCHLD Signals on win32. Please tell m (Ilya Zakharevich)
tell me the currrent line number? sstarre@my-dejanews.com
Re: tell me the currrent line number? <jdf@pobox.com>
Re: tell me the currrent line number? (Matthew Bafford)
Re: Values of 'true' and 'false'? (Ronald J Kimball)
Re: want to learn about refs? Was: How do you use a var (Walter Tice USG)
Re: Want to learn Perl (ICG's)
Re: Why doesn't \n work <petes@hempseed.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 27 Mar 1999 00:58:10 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: $alreadyHaveError parameter problem
Message-Id: <1dpav2y.1h6pixju7mh8uN@p45.block2.tc1.state.ma.tiac.com>
Dan Smorey Jr. <dsmorey@unconundrum.com> wrote:
> $haveError always has something in it, either 1 or 0, so
> $alreadyHaveError should be assigned. First thing I thought was, global
> variable, maybe this variable is assigned somewhere else and being
> assigned null. I grep'd all the files in my project and didn't find a
> single $alreadyHaveError. So, I thought maybe it's the away I'm
> assigning it...
If it doesn't appear anywhere else, how do you know that
$alreadyHaveError doesn't get the value assigned to it? You must be
using the value of $alreadyHaveError somewhere, right?
You probably spelled the variable's name wrong when you tried to use it.
Make sure the capitalization is consistent.
--
chipmunk (Ronald J Kimball) <rjk@linguist.dartmouth.edu>
perl -e 'print map chop, sort split shift, reverse shift
' 'j_' 'e._jP;_jr/_je=_jk{_jn*_j &_j :_j @_jr}_ja)_js$_j
~_jh]_jt,_jo+_jJ"_jr>_ju#_jt%_jl?_ja^_jc`_jh-_je|' -rjk-
------------------------------
Date: Sat, 27 Mar 1999 07:47:44 GMT
From: jt45@tir.com (Murphy)
Subject: Re: [AJM] Need assistance with sockets and Perl
Message-Id: <36ff8d0d.396583@news.supernews.com>
On Thu, 25 Mar 1999 00:04:30 -0500, rjk@linguist.dartmouth.edu (Ronald
J Kimball) wrote this little gem:
>Murphy <jt45@tir.com> wrote:
>
>> The following works well if I launch the server on
>> MachineA and the client on MachineA. But if I try to use the client
>> on MachineB and the server on MachineA, I get an error.
>
>And that error is...?
Ackk.. I new I forgot something...
Here are the errors: The first is when I try to access the server by
name, and the second when I try to use it's IP address directly.
---
M:\Apache BEMS Server\PerlTest>perl client1.pl bems test
getservbyname: cannot get test : Unknown error at client1.pl line 19.
---
M:\Apache BEMS Server\PerlTest>perl client1.pl 152.116.112.166 test
gethostbyname: cannot locate host: Unknown error at client1.pl line
17.
---
Ok, here's the code again (in case the server no longer has it).
----------------------------
------->Client1.pl<--------
#!/usr/bin/perl -w
use Socket;
$NETFD = &makeconn($ARGV[0], $ARGV[1]);
sysread $NETFD, $message, 32768 or die "error getting message: $!";
print "$message \n";
close $NETFD;
sub makeconn {
my ($host, $portname, $server, $port, $proto, $servaddr);
$host = $_[0];
$portname = $_[1];
$server = gethostbyname($host) or
die "gethostbyname: cannot locate host: $!";
$port = getservbyname($portname,'tcp') or
die "getservbyname: cannot get $portname : $!";
$proto = getprotobyname('tcp') or
die "getprotobyname: cannot get proto : $!";
$servaddr = sockaddr_in($port,$server);
socket(CONNFD, PF_INET, SOCK_STREAM, $proto);
connect(CONNFD, $servaddr) or die "connect : $!";
return CONNFD;
}
------------------------------------
------>Server1.pl<----------
#!/usr/bin/perl
use Socket;
$hello = "Welcome to the test server";
$LISTFD = &makelisten("test");
LOOP: while(1) {
unless($paddr = accept(NEWFD, $LISTFD)) {
next LOOP;
}
syswrite(NEWFD,$hello,length($hello));
close NEWFD;
}
sub makelisten {
my ($portname, $port, $proto, $servaddr);
$portname = $_[0];
$port = getservbyname($portname,'tcp') or
die "getservbyname: cannot get port : $!";
$proto = getprotobyname('tcp') or
die "getprotobyname: cannot get proto :$!";
socket(LISTFD,PF_INET,SOCK_STREAM,$proto);
bind(LISTFD,sockaddr_in($port,INADDR_ANY)) or die "bind: $!";
listen(LISTFD,SOMAXCONN) or die "listen: $!";
return LISTFD;
}
Murphy
-----------
jt45@tir.net
"Trying is the first step towards failure" - Homer J. Simpson
"Programming isn't about Java or Visual Basic. It's about real Languages" - CDI Commercial
------------------------------
Date: Sat, 27 Mar 1999 01:58:52 -0500
From: "Steven T. Hatton" <hattons@cpkwebser5.ncr.disa.mil>
Subject: Re: anything like xemacs for win32?
Message-Id: <36FC81AC.11214AC4@cpkwebser5.ncr.disa.mil>
Awesome! Thanks! Took a while to figure it out. I really need to sit
down and read up on emacs. I'm sure once you get a feel for the rather
arcane help and UI it is an extraordinary tool. I do like xemacs. I've
never done more than toy with emacs.
Steve
Jeff Zucker wrote:
> cperl mode for emacs does great color syntax highlighting on win32.
>
> --
> jeff
------------------------------
Date: 27 Mar 1999 07:49:39 GMT
From: "Peter Sergeant" <petes@hempseed.com>
Subject: Compiling Perl Scripts
Message-Id: <01be7826$f4d2d220$e2e5abc3@martinse>
If I've written a Perl Script in a Win95 or Dos version of Perl, is there
any program I can get to compile it as an EXE that will work on any
computer?
Thanks for the time
Peter J Sergeant
------------------------------
Date: 27 Mar 1999 07:57:06 GMT
From: "Peter Sergeant" <petes@hempseed.com>
Subject: Re: Counter Digits
Message-Id: <01be7827$ff8ad9a0$e2e5abc3@martinse>
My advice? Look at Matt's Graphical Counter, at
http://www.worldwidemart.com/scripts
Peter J Sergeant
Christian <cb2001@hotmail.com> wrote in article
<36fbd156.0@info.xpoint.at>...
> Hi
>
> i programmed a counter in perl and now i want to show the hits on the
page
> so the user know, i'm visitor (eg. 00102) i made 10 gif files each
> containing one digit.
> so can anyone please tell me how to yoin the digits from a counter
together
> (on the fly).
>
> fast help would be appreciated
>
> many thanks in advance
>
> chris
>
>
>
------------------------------
Date: Sat, 27 Mar 1999 07:17:13 GMT
From: rogdh@iname.com (rogerDH)
Subject: Re: Easy ?... why doesn't this script run on NT?... Thanks Bill!!
Message-Id: <36fc85ea.18642035@news.earthlink.net>
On Fri, 26 Mar 1999 22:54:07 -0800, moseley@best.com (Bill Moseley)
wrote:
>In article <36fc47a7.2703237@news.earthlink.net>, rogdh@iname.com says...
>> I type this in on my command line...
>> perl -e 'print "hello, world!";'
>>
>> The error message I get is...
>> Can't find string terminator "'" anywhere before EOF at -e line 1.
>
>Windows doesn't understand single quotes.
>
>perl -e "print 'hello, world!'"
>
>You don't need double quotes, anyway, in that line.
------------------------------
Date: Fri, 26 Mar 1999 22:54:07 -0800
From: moseley@best.com (Bill Moseley)
Subject: Re: Easy ?... why doesn't this script run on NT?
Message-Id: <MPG.116620661f7587f79896fc@206.184.139.132>
In article <36fc47a7.2703237@news.earthlink.net>, rogdh@iname.com says...
> I type this in on my command line...
> perl -e 'print "hello, world!";'
>
> The error message I get is...
> Can't find string terminator "'" anywhere before EOF at -e line 1.
Windows doesn't understand single quotes.
perl -e "print 'hello, world!'"
You don't need double quotes, anyway, in that line.
--
Bill Moseley mailto:moseley@best.com
------------------------------
Date: Sat, 27 Mar 1999 07:47:29 GMT
From: salbarcar@my-dejanews.com
Subject: HELP HELP HELP HELP HELP
Message-Id: <7di2ef$dvn$1@nnrp1.dejanews.com>
Is it possible to use an ssi tag from within a cgi (perl) script? I'm trying
to customize the look of the HTML output of a script that I have and I'd like
the outputted page to include some ssi tags.
IS THIS POSSIBLE??!!! I've tried it and it doesn't work obviously. Is there
another way of doing it?
PLEASE E-MAIL ME AT steve@grandemesa.com if you have an answer.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 27 Mar 1999 05:04:54 GMT
From: lesneste@mindspring.com (Les Neste)
Subject: Help! How scanf() in Perl?
Message-Id: <36fc6625.22137451@news.mindspring.com>
Hi friends,
I'm relatively new to Perl but seem to have reached critical mass for
writing useful code. Still one thing I haven't seen, though: is
there a way to get the same functionality as C provides through
scanf()? I can figure out how to get the same result, but I end up
having to write a lot of case-specific code, and I wonder whether Perl
provides a general-purpose solution?
Thanks in advance.
Les Neste
------------------------------
Date: 27 Mar 1999 07:48:05 GMT
From: "Peter Sergeant" <petes@hempseed.com>
Subject: Making Perl work with Netscape / IE
Message-Id: <01be7826$bc730ee0$e2e5abc3@martinse>
How can I make a Perl work with my internet browser. By this, I mean, if I
install either a Dos or Win95 version, how can I use it to test my CGI
scripts. I have MS Personal Web Server. Should this help?
Thanks for your time.
Peter J Sergeant
------------------------------
Date: Fri, 26 Mar 1999 23:13:54 -0500
From: "RANDALL LEBLOND" <leblondrp.m@worldnet.att.net>
Subject: Need help with WIN32::GUI
Message-Id: <7dhm2a$rdd$2@bgtnsc01.worldnet.att.net>
I'm not new to programming with Perl, but I am new to programming with
modules. I tried to install WIN32::GUI using the install.bat file included
and then ran the sample file hello.pl and came up with this message:
Can't load 'D:\PERL\site\lib\auto\Win32\GUI\GUI.dll' for module Win32::GUI:
load
_file:One of the library files needed to run this application cannot be
found at
D:\PERL\lib/DynaLoader.pm line 168.
at hello.pl line 8
BEGIN failed--compilation aborted at hello.pl line 8.
Deep recursion on subroutine "Win32::GUI::AUTOLOAD" at
D:\PERL\site\lib/Win32/GU
I.pm line 340.
Out of memory!
Error: Parse exception
The files are where they are suppose to be, I'm guessing from reading
previous posts about this that I need to rebuild the module to work with my
copy or perl? I am running Activestate Perl for win32 version 5.00502.
Please help me and tell me what I'm suppose to do. -David
link@ipass.net
------------------------------
Date: Fri, 26 Mar 1999 23:51:18 +0000
From: Nick Mangano <netlist-usa@worldnet.att.net>
Subject: Passing a reference to a subroutine to another subroutine.
Message-Id: <36FC1D75.95A383CE@worldnet.att.net>
Hi,
I need to pass a reference to a subroutine, lets call it sub A, to
another subroutine, lets call it sub B.
Here is the code that I have been trying, but keep getting errors:
$ref_a = \&a;
$return = &b{"name", 1, 30, "a", $ref_a};
if ($return eq "-1"){
print ("No name entered\n");
}else{
print ("Name is $return\n");
}
I get the following error message:
Can't use subscript or subroutine entry at midterm.pl at line 32, near
"$ref_valname}"
(Did you mean $ or @ instead of &?)
Can anyone tell me where I'm going wrong.
Thanks
Nick
------------------------------
Date: 27 Mar 1999 00:25:54 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: netlist-usa@worldnet.att.net
Subject: Re: Passing a reference to a subroutine to another subroutine.
Message-Id: <m3d81vjyfx.fsf@joshua.panix.com>
Nick Mangano <netlist-usa@worldnet.att.net> writes:
> $return = &b{"name", 1, 30, "a", $ref_a};
> (Did you mean $ or @ instead of &?)
&b{} is nonsensical. Do you mean to call a subroutine called "b"?
b();
or
&b();
Do you mean to refer to a hash slice?
@b{foo, bar};
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Fri, 26 Mar 1999 22:57:58 -0500
From: "RANDALL LEBLOND" <leblondrp.m@worldnet.att.net>
Subject: Re: Perl Composer Needed
Message-Id: <7dhm29$rdd$1@bgtnsc01.worldnet.att.net>
Check www.winfiles.com and look for something like PerlBuilder or CodeMagic
(a universal IDE). Hope this helps. -David
------------------------------
Date: Sat, 27 Mar 1999 00:58:17 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: regular expression
Message-Id: <1dpavje.u19oas14hntz1N@p45.block2.tc1.state.ma.tiac.com>
Rick Delaney <rick.delaney@home.com> wrote:
> Bob Trieger wrote:
> >
> > while (defined(<FH>)) {
> ^^^^^^^
> This is never necessary, not even in 5004. It can always be written as
>
> while (<FH>) {
> .
It's not just unnecessary. It's a serious bug. <FH> magically assigns
to $_ only when it is *alone* in a loop conditional. In the above
expression, it is not alone; the value read from FH is tested for
definedness, and then it is *discarded*.
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 27 Mar 1999 07:54:53 GMT
From: "Peter Sergeant" <petes@hempseed.com>
Subject: Re: script headers
Message-Id: <01be7827$b016e260$e2e5abc3@martinse>
The most likely, I would say, is that you're uploading using Binary rather
than ASCII mode.
Premature end of script headers doesn't mean exactly what you might think,
so just looking at the script headers isn't going to help. Email the script
if you want, and I'll see if I can find a problem.
Peter J Sergeant
Jay Knight <jhknight@olemiss.edu> wrote in article
<36FBFC14.9D9D6309@olemiss.edu>...
> Dear experienced people,
> Most of the time, when I run scripts from the browser, I get a
> Internal Server Error. So, I go to my server's error log, and there's an
> error that says premature end of script headers. There are some simple
> scripts that work fine, and as far as I can tell the headers are the
> same. What might cause these headers to end prematurely? is it a
> script error, and perl interpretation error, or possibly a server
> (apache1.3.4, win98) error? thanks a bunch.
>
> Dumb little newbie,
> Jay Knight
>
>
------------------------------
Date: Sat, 27 Mar 1999 08:27:58 GMT
From: zimdog@netscape.net
Subject: Sending a cookie to a server with a perl script
Message-Id: <7di4qa$gne$1@nnrp1.dejanews.com>
Hello all, I am currently having trouble finding a method to capture and
resend a cookie to a server. I am trying to write a script to access a web
server but the cookies are really confusing me. If I append the following
when getting a document /crsadm/CrsAdm?username=johndoe&pin=1234 I get the
following returned Set-Cookie
TSRVAuthorization=username=johndoe&pin=1234&validated=YES; path=/. I have
been searching and reading and am totally stumped on how to do this. Here is
the script i am trying to run. #! /usr/bin/perl use IO::Socket; use CGI
qw(:standard); $host = "train.com"; $document = "/crsadm/CrsAdm"; $remote =
IO::Socket::INET->new( proto => "tcp", PeerAddr => $host, PeerPort =>
"http(80)", ); unless ($remote) { die "cannot connect to http daemon on
$host"} $remote->autoflush(1); $c1 = cookie( -name=>'username',
-value=>'johndoe'); $c2 = cookie( -name=>'pin', -value=>'1234'); $c3 =
cookie( -name=>'validated', -value=>'yes', -path=>'/'); $c4 = cookie(
-name=>'returnClass', -value=>'CrsAdm', -path=>'/'); print
header(-cookie=>[$c1,$c2,$c3,$c4]); print $remote "get $document HTTP/1.0\n\n
header(-cookie=>[$c1,$c2,$c3,$c4])"; while ( <$remote> ){ print; }
-close $remote;
Instead of taking the cookie I am sent back to the login page and this is
what is printed HTTP/1.0 200 OK Content-Type: text/html Date: Sat, 27 Mar
1999 08:20:04 GMT Allow: GET, HEAD Server: Oracle_Web_listener3.0/2.13
Set-Cookie: TSRVAuthorization=returnClass=CrsAdm; path=/ ... to end of html
of login page.
If someone can tell me what I am doing wrong or a better way to do this I
would greatly appreciate it. TIA Mike
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Mar 1999 08:52:36 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: SIGPIPE and SIGCHLD Signals on win32. Please tell me what is wrong.
Message-Id: <7di68k$2ne$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Patrice M.I. Parmentier
<ppa@itmasters.com>],
who wrote in article <36FB9169.7364E4AD@itmasters.com>:
> $SIG{PIPE} = sub {
> print "SIGPIPE called...\n";
> exit (-666);
> };
> $SIG{CHLD} = sub {
> print "SIGCHLD called...\n";
> exit (-555);
> };
>
> $pid = open (HPIPE, "| buggything") or die "Cannot fork\n";
> print "pid = $pid\n";
>
> $n = 0;
> while (1)
> {
> print HPIPE $n++ . "\n";
> }
> #########################################################
>
> This script just pipes a series of integers to a command 'buggything'. I
> want that my script stop when the 'buggything' stops.
>
> All works fine on Solaris, AIX and HPUX, but not on NT.... Perlfaq and
> other docs tell to catch sigpipe and sigchld.
Perlfaq is (mostly) applicable to Unixish systems only (due to Tom's
agenda - only systems with primitive sub-VMS APIs have a reason to
exist). Same for CookBook (which is excellent *if* you take it with a
grain of salt outside of Unix).
> I do not understand why
> this script does not work on NT (the signal handlers are never called).
Because they should not be called (at least if buggything does not
exist).
> Probably i am unable to understand the doc, so can somebody tell me what
> is wrong???
Obviously, you should (may?) get no SIGCHLD on NT: NT has sane process
starting API, so with a sane implementation of "open" on the Perl side
no child will be started. (This is what happens, say, on OS/2. But
note that with older 5.004 vintage OS/2 perls open() will wrongly
succeed.)
The reason why you get no SIGPIPE is a little bit less obvious. Since
open() did not succeed, HPIPE is an invalid handle. Thus no write to
any kind of a pipe is performed, thus you can get no SIGPIPE.
The only question is why open() succeeds. If buggything actually
exists, it is a safe bet that non-delivery of SIGCHLD and SIGPIPE is
just a shortcoming of the NT port. I think the only workaround you
have is to check the result of all the print()s
print FOO $bar or die "print failed: $!";
Hope this helps,
Ilya
------------------------------
Date: Sat, 27 Mar 1999 04:24:15 GMT
From: sstarre@my-dejanews.com
Subject: tell me the currrent line number?
Message-Id: <7dhmha$4ev$1@nnrp1.dejanews.com>
I'd like to know how many lines are in my textfile. I think that:
open F,"./myfile";
seek F,0,2;
tellmethelinenumber();
would work and be nice & speedy, if anyone can tel me if there is such a
function? Right now I'm counting using:
while(<F>) #and its getting painfully slow as the file goes over
{$i++;}
the 10K line mark.
I searched news for this topic and found nothing related, although I'm
wondering just how far back searching goes in Dejanews. Seems like this
would have already been asked & answered.
Cheers & Thanks,
S
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 27 Mar 1999 00:06:35 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: sstarre@my-dejanews.com
Subject: Re: tell me the currrent line number?
Message-Id: <m3g16rjzc4.fsf@joshua.panix.com>
sstarre@my-dejanews.com writes:
> open F,"./myfile";
> seek F,0,2;
> tellmethelinenumber();
No such animal, unless you know that each line has the same number of
bytes in it, in which case
$lines = tell(F) / $bytes_per_line;
> while(<F>) #and its getting painfully slow as the file goes over
> {$i++;}
>
> the 10K line mark.
Tough noogies. Here's a one-line replacement for wc -l :
perl -ne 'END{print "$.\n"}'
see perlvar for the $. variable. See perlrun for the -n and -e
switches. See perlmod and perlfaq8 for the END block. HTH.
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: Sat, 27 Mar 1999 05:05:34 GMT
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: tell me the currrent line number?
Message-Id: <slrn7foolv.lmm.dragons@scescape.net>
Sat, 27 Mar 1999 04:24:15 GMT -- sstarre@my-dejanews.com <sstarre@my-dejanews.com>:
-> I'd like to know how many lines are in my textfile. I think that:
->
-> open F,"./myfile";
-> seek F,0,2;
-> tellmethelinenumber();
->
-> would work and be nice & speedy, if anyone can tel me if there is such a
-> function? Right now I'm counting using:
You are very confused about how lines are represented in files...
-> while(<F>) #and its getting painfully slow as the file goes over
-> {$i++;}
A line is a set of characters seperated by either \cJ, \cM\cJ, \cM, or
what ever the operating system/program wants it to be.
You could easily define lines to end with an 'a', for example by changing
$/:
$/ = 'a';
The operating system doesn't care how many line ending characters a file has,
so the only way to find out is to count them.
It would be slightly faster if you read in more data at a time and just counted
characters.
For example:
(from PCB):
$count += tr/\n/\n/ while sysread(FILE, $_, 2**16);
-> Cheers & Thanks,
HTH!
-> S
--Matthew
------------------------------
Date: Sat, 27 Mar 1999 00:58:19 -0500
From: rjk@linguist.dartmouth.edu (Ronald J Kimball)
Subject: Re: Values of 'true' and 'false'?
Message-Id: <1dpavqg.1bnjdb4b2v1umN@p45.block2.tc1.state.ma.tiac.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
> Rob Greenbank wrote:
>
> >I came across the following behavior:
> > $val = 8 && 1; # $val is 1
> > $val = 8 and 1; # $val is 8
> > $val = 8 && 4; # $val is 4
> > $val = 8 and 4; # $val is 8
> >
> >On the surface, it appears like "&&" and "and" evaluate differently.
>
> No, it's a matter of precencence. I must take care to say it right this
> time ;-). { $val = 8 and 1; } means the same as { ($val = 8) and 1; },
> therefore the "and 1" part is useless.
Hint: "On the surface, it appears...."
Bart, read the whole message next time.
In fact, you didn't even make it to the next sentence:
> > The real problem (and the problem with my friend's program) is
> > precedence, as the "=" is evaluated before the "and". Add parens and
> > "$val = (8 and 4)" gives the expected result.
:)
--
_ / ' _ / - aka -
( /)//)//)(//)/( Ronald J Kimball rjk@linguist.dartmouth.edu
/ http://www.tiac.net/users/chipmunk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 26 Mar 1999 19:04:24 GMT
From: tice@hunch.zk3.dec.com (Walter Tice USG)
Subject: Re: want to learn about refs? Was: How do you use a variable in an array name?
Message-Id: <7dglno$p5t@zk2nws.zko.dec.com>
In article <36FBC6D2.E5B8A0C7@atrieva.com> Jerome O'Neil <jeromeo@atrieva.com> writes:
>diane6683@my-dejanews.com wrote:
>For all the exciting detail on perl data structures, see the perldsc
>documentation. You also might want to peruse the perlref document for
>information on using perl references.
>Good Luck!
I've never been a big fan of the perldsc, finding it somewhat opaque
compared to most of the perldoc. About 2 months ago I stared writing
a note to the group detailing what IMO was a good way to tackle this
area, here in it's unvarnished and unfinished state it is. No warranty.
#################################################################
Want to learn more about Perl References, Lists, and Data Structs?
These are the sources I used, with a quick comment about each:
Suggested Order:
Understand References:
1. Understand References Today:
http://www.plover.com/~mjd/perl/FAQs/references.html
Comments: very nice intro, mjd is correct in noting that
perlref is less clear then most of the CPAN doc's.
2. Chapter 1: Data References and Anonymous Storage (pp 1-12)
Advanced Perl Programming by Srinivasan
Comments: Extremely well layed out, and explained. Not
likely to be on the bookshelf of most of this audience, but,
worth getting for the first 6 Chapters, and some of the
next 14 (w.r.t. intermediate audience).
Learn to create complex heterogeneous data structs using refs:
3. Chapter 1: Data References and Anonymous Storage (pp 13-15)
Advanced Perl Programming by Srinivasan
Refs and Subroutines:
1. Subroutines and References in Perl with Snippets
http://www.troubleshooters.com/codecorn/littperl/perlsub.htm
Programming Perl Chapter 4: References and Nested Data Structures (pp 243-251)
Data Structs section (257-275)
Effective Perl Programming Chapter splain' (pp. 117-123)
Unix Review Column 7 (March 1996) - "Reference"
..(abrupt ending) oh well.. it started out well, hope it helps.
W
------------------------------
Date: Sat, 27 Mar 99 03:26:50 GMT
From: postmaster@uu.net (ICG's)
Subject: Re: Want to learn Perl
Message-Id: <7dhmr9$doa$1@mtinsc01.worldnet.att.net>
In article <slrn7fe7j8.6eo.sholden@pgrad.cs.usyd.edu.au>, sholden@cs.usyd.edu.au wrote:
>On 23 Mar 1999 03:29:21 GMT, ICG's <postmaster@uu.net> wrote:
>>
>>At first, I hated the concept of Java. But it's usefull for neat little
>>tricks that are impossible in Perl. Perl on the other hand, can do things
>>that Java can't do. (such as fingering 3 separate network access servers,
>>doing a selective port scan across 15 IPs, manipulating the data and telling
>>you the state of all the critical systems and services in an ISP, and the
>>number of users <with logon names>)
>
>That is possible in Java, it might need a little more code but it is possible.
>
Ahh, that's the catch. 200 or so lines (or less, I included comments) of
Perl. My pref is a good load time. The bad part about the script is you have
to wait for the other servers to answer up. It's sort of a trade off. Spit
the Java enhanced HTML out to the client, and have the client do the querying,
or do it locally (maintaining some of the integrety of the servers by not
giving out un-neccessary info), and returning the results.
------------------------------------------------------------
Not the Postmaster, I hate SPAM.
M. H. Mogk breeze <at> granis.net
Stuff for the automated colledtors....
abuse-mail@uu.net
abuse@aol.net
postmaster@ibm.net
abuse@sprynet.com>
------------------------------
Date: 27 Mar 1999 07:59:03 GMT
From: "Peter Sergeant" <petes@hempseed.com>
Subject: Re: Why doesn't \n work
Message-Id: <01be7828$450c1fc0$e2e5abc3@martinse>
If I've got this wrong, please forgive me.
If you mean that the text output to your browser doesn't go down a line,
this is because you're outputting HTML. HTML doesn't recognise returns in
the coding. Therefore, use a <BR> or <P> sign to skip lines.
Steven Shaw <Steve@rossbyweather.com> wrote in article
<36fb9648.0@news.hcsys.com>...
> When executing my Perl script in IE or Netscape, the "\n" that I attach
to
> my print statement will not skip a line.
>
> Steven Shaw
>
>
>
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 5238
**************************************