[10296] in Perl-Users-Digest
Perl-Users Digest, Issue: 3889 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 5 00:08:34 1998
Date: Sun, 4 Oct 98 21:00:19 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sun, 4 Oct 1998 Volume: 8 Number: 3889
Today's topics:
Accessing Checkboxes in Perl <anty_84@yahoo.com>
Re: Accessing Checkboxes in Perl <rick.delaney@shaw.wave.ca>
Re: bidirectional pipes & pttys? <spamsux-tex@habit.com>
Re: CGI.pm - forms within tables - How to? (Craig Berry)
Editing a file "in-place" (Tom Tingdale)
Re: Editing a file "in-place" <rick.delaney@shaw.wave.ca>
Error Message....GD.pm <yrsow@bestweb.net>
hashes and stuff <opieweb@hotmail.com>
Re: hashes and stuff <matt@whiterabbit.co.uk>
Re: hashes and stuff (Ronald J Kimball)
Re: hashes and stuff (Larry Rosler)
Re: help with finding a regular expression (David Alan Black)
Re: HERE Documents and skipping indentation (advanced) (Ronald J Kimball)
Re: HERE Documents and skipping indentation (advanced) <tchrist@mox.perl.com>
Keeping a running list of the top n values retrieved (Nick Tonkin)
Re: Multi-dimensional arrays (Larry Rosler)
Need Help with Selena Sol's Web_store <jposey@mindspring.com>
Re: Newbie question about variable scope (Joergen W. Lang)
Passing Variables: $_ vs. @_ <webmaster@kvoa.com>
Re: Passing Variables: $_ vs. @_ (Larry Rosler)
Perlscript with WSH? (Martin Oakley)
Re: return status of a remote shell command <tchrist@mox.perl.com>
Re: Sites devoted to Perl Win32 <cowanb@mindspring.com>
Re: What is the maining of "Bare word" (Wong Kin Sang)
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 4 Oct 1998 20:46:51 -0500
From: "Anthony Smith" <anty_84@yahoo.com>
Subject: Accessing Checkboxes in Perl
Message-Id: <6v98ej$h40$1@blue.hex.net>
Anyone know how to get a checkbox to return a true false statement in perl?
Does it require the cgi.pm module?
------------------------------
Date: Mon, 05 Oct 1998 03:13:43 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Accessing Checkboxes in Perl
Message-Id: <36183AF5.B3E03A08@shaw.wave.ca>
Anthony Smith wrote:
>
> Anyone know how to get a checkbox to return a true false statement in
^^^^^^^^^^^^^^^^^^^^
> perl? Does it require the cgi.pm module?
This should be true when false.
use CGI;
my $query = new CGI;
# insert other necessary code here
print $query->checkbox(-name=>'checkbox_name',
-checked=>'checked',
-value=>'FALSE',
-label=>'true false statement');
# yada yada
print "true" if $query->param('checkbox_name');
But seriously, what the heck are you asking? CGI.pm is a good place to
start if you want to use cgi with perl.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sun, 04 Oct 1998 16:20:18 +0000
From: Austin Schutz <spamsux-tex@habit.com>
Subject: Re: bidirectional pipes & pttys?
Message-Id: <3617A042.5A88@habit.com>
Jonathan Stowe wrote:
>
> On Fri, 02 Oct 1998 20:28:54 GMT James Davis <james.davis@corp.home.net> wrote:
> > Have a tty-less PERL script running rsh commands, unable to receive
> > results of output using open2. Any way to establish a ptty beforehand,
> > and will this solve the problem?
>
use Expect;
$rsh = Expect->spawn("rsh otherhost");
...
Austin
------------------------------
Date: 4 Oct 1998 23:07:15 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: CGI.pm - forms within tables - How to?
Message-Id: <6v8v33$fep$1@marina.cinenet.net>
Larry Hunter (lhunter@acm.org) wrote:
: In article <6ur3q8$2fm$3@marina.cinenet.net>, cberry@cinenet.net says...
: >Note that since you want the radio buttons in separate cells, you can't
: >use CGI.pm's radio_group function; hence the literal HTML for these.
:
: You CAN use the radio_group function for this. Assign its return value
: to an array, and you get a list of the radio button components. Then
: you can arrange them in table cells for whatever layout you want.
So I discovered thanks to another reply in this thread. CGI.pm just keeps
on impressing me after a year or more of using it!
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| "Ripple in still water, when there is no pebble tossed,
nor wind to blow..."
------------------------------
Date: Mon, 05 Oct 1998 01:27:35 GMT
From: tingdale@flash.net (Tom Tingdale)
Subject: Editing a file "in-place"
Message-Id: <36181d3c.11451990@news.flash.net>
I have seen an example here before on how to edit a file in place, but
when I try it nothing happens - the file is not changed. Here is the
code:
-----------------------------------
#!/usr/local/bin/perl -wi
use strict;
open (FILE, "+< filename.txt") || die "Cannot open filename.txt:$!\n";
while (<FILE>) {
s/text/newtext/;
}
---------------------------------
It doesn't make any difference how I open the file, the file is not
changed. What I'm I doing wrong?
Thanks for any help you can offer.
Tom Tingdale
tingdale@c2o.com
tingdale@flash.net
------------------------------
Date: Mon, 05 Oct 1998 02:55:25 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: Editing a file "in-place"
Message-Id: <361836A6.BE7CF10D@shaw.wave.ca>
[posted & mailed]
Tom Tingdale wrote:
>
> I have seen an example here before on how to edit a file in place, but
> when I try it nothing happens - the file is not changed. Here is the
> code:
> -----------------------------------
> #!/usr/local/bin/perl -wi
> use strict;
>
> open (FILE, "+< filename.txt") || die "Cannot open filename.txt:$!\n";
> while (<FILE>) {
> s/text/newtext/;
> }
> ---------------------------------
> It doesn't make any difference how I open the file, the file is not
> changed. What I'm I doing wrong?
Not reading the docs or faqs? :-)
Look up -i in perlrun if you want to use it. Also see perlfaq5, "How do
I change one line in a file/delete a line in a file/insert a line in the
middle of a file/append to the beginning of a file?"
One way, from the command line:
cli $ perl -i -pe 's/text/newtext/;' filename.txt
Another way:
#!/usr/local/bin/perl -wi.bak
use strict;
@ARGV = qw {filename.txt};
while (<>) {
s/text/newtext/;
print; # !! You need to print the modified records
}
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sun, 04 Oct 1998 20:21:27 -0400
From: Eugene <yrsow@bestweb.net>
Subject: Error Message....GD.pm
Message-Id: <36181107.45DD0D4C@bestweb.net>
Hi there,
I am trying to understand the error
message below that is generated by
the server when I tried to run a
script that uses GD.pm. I just
installed the GD.pm modual in my
private directory and I guess I
did't not installed correctly. Can
any one tell me what this message
means.. and how I can correct it.
Thanks
Eugene
[Sun Oct 4 14:23:28 1998] GD.pm:
[Sun Oct 4 14:23:28 1998]
FileHandle.pm:
Can't load
'/y/r/yrsow/.perl_pm/i386-freebsd/auto/GD/GD.so'
for
module GD: Undefined symbol
"_Perl_stack_base" in
perl:/y/r/yrsow/.perl_pm/i386-freebsd/auto/GD/GD.so
at
/usr/local/lib/perl5/i386-freebsd/DynaLoader.pm
line 168. [Sun Oct 4
14:23:28 1998] GD.pm: [Sun Oct 4
14:23:28 1998] FileHandle.pm: [Sun
Oct 4
14:23:28 1998] GD.pm: [Sun Oct 4
14:23:28 1998] FileHandle.pm: at
draw.cgi
line 11 BEGIN failed--compilation
aborted at draw.cgi line 11.
------------------------------
Date: Sun, 04 Oct 1998 18:03:50 -0500
From: Bryn Bellomy <opieweb@hotmail.com>
Subject: hashes and stuff
Message-Id: <3617FED6.A5EB9422@hotmail.com>
Hi, I just started learning Perl...ahhh... yesterday. I have a fairly
simple question - how can I make this password script work (it uses a
hash):
%userpass = (
"usr" => "password",
"usr2" => "password2",
);
&login;
sub login
{
$switch1 = 2;
print "\n" x 80;
print "\n\nLogin\n\n";
print "Username: ";
chomp ( $user = <STDIN> );
print "Password: ";
chomp ( $pass = <STDIN> );
if ( $userpass{ $user } == $pass )
{
&correct;
}
elsif ( $userpass{ $user } != $pass )
{
&incorrect;
}
}
The problem is that when I run it, any password/username combination
works. I left out the other SUB's because they don't really matter.
All help appreciated! Please mail me, not post here:
opieweb@hotmail.com
Bryn Bellomy
------------------------------
Date: Mon, 05 Oct 1998 00:55:26 +0100
From: Matt Pryor <matt@whiterabbit.co.uk>
To: Bryn Bellomy <opieweb@hotmail.com>
Subject: Re: hashes and stuff
Message-Id: <36180AEE.672C269B@whiterabbit.co.uk>
Bryn,
This is a string comparison, not numeric.
Replace all instances of "==" with "eq" and all instances of "!=" with
"ne" and this will solve your problem.
Matt
--
Bryn Bellomy wrote:
>
> Hi, I just started learning Perl...ahhh... yesterday. I have a fairly
> simple question - how can I make this password script work (it uses a
> hash):
>
> %userpass = (
> "usr" => "password",
> "usr2" => "password2",
> );
>
> &login;
> sub login
> {
> $switch1 = 2;
> print "\n" x 80;
> print "\n\nLogin\n\n";
>
> print "Username: ";
> chomp ( $user = <STDIN> );
>
> print "Password: ";
> chomp ( $pass = <STDIN> );
>
> if ( $userpass{ $user } == $pass )
> {
> &correct;
> }
> elsif ( $userpass{ $user } != $pass )
> {
> &incorrect;
> }
> }
> The problem is that when I run it, any password/username combination
> works. I left out the other SUB's because they don't really matter.
> All help appreciated! Please mail me, not post here:
> opieweb@hotmail.com
>
> Bryn Bellomy
--
Matt's daily comic strip
Porridge and Fartcakes
http://www.whiterabbit.co.uk/cartoons
------------------------------
Date: Sun, 4 Oct 1998 20:02:56 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: hashes and stuff
Message-Id: <1dge4y3.e28yr91v6rha8N@bay1-529.quincy.ziplink.net>
[posted and mailed]
Bryn Bellomy <opieweb@hotmail.com> wrote:
> if ( $userpass{ $user } == $pass )
> elsif ( $userpass{ $user } != $pass )
These are numeric comparisons. You want string comparisons. Refer to
the perlop documentation, and then use eq and ne in place of == and !=.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: Sun, 4 Oct 1998 19:38:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: hashes and stuff
Message-Id: <MPG.1081d0ef1713d65e98989c@nntp.hpl.hp.com>
In article <1dge4y3.e28yr91v6rha8N@bay1-529.quincy.ziplink.net> on Sun, 4
Oct 1998 20:02:56 -0400, Ronald J Kimball <rjk@coos.dartmouth.edu>
says...
> Bryn Bellomy <opieweb@hotmail.com> wrote:
>
> > if ( $userpass{ $user } == $pass )
>
> > elsif ( $userpass{ $user } != $pass )
>
> These are numeric comparisons. You want string comparisons. Refer to
> the perlop documentation, and then use eq and ne in place of == and !=.
And note that the second test is redundant. It is the logical negation
of the first test, so all you need is
else ...
instead of the
elsif ( ...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 4 Oct 1998 21:15:18 -0400
From: dblack@pilot.njin.net (David Alan Black)
Subject: Re: help with finding a regular expression
Message-Id: <6v96j6$34c$1@pilot.njin.net>
Hello -
Toby Howard <toby@hans.cs.man.ac.uk> writes:
>Hi, I'd be very grateful if anyone could help me to find a regular
>expression that substitutes one string for another, but only if the string
>to be replaced appears within two other known fixed delimiters. For
>example, given:
> "Hello<delim>Here's my problem</delim>everyone."
>The regexp would replace all "e"s by "*"s, but only if the "e"s lie within
><delim></delim>:
> Hello<delim>h*r*'s my probl*m</delim>everyone.
This version is similar in principle to Garry's but easier to
maintain, as it abstracts the delimiter into a variable which
you can redefine if it changes (assuming the basic tag syntax
remains the same).
#!/usr/local/bin/perl -w
use strict;
my $s = "Hello<delim>Here's my problem</delim>everyone.\n";
my $d = "delim";
$s=~s!(?:<$d>)(.*?)(?:</$d>)!(my$x=$1)=~tr/e/*/;$x!ge;
print $s;
David Black
dblack@pilot.njin.net
------------------------------
Date: Sun, 4 Oct 1998 19:28:53 -0400
From: rjk@coos.dartmouth.edu (Ronald J Kimball)
Subject: Re: HERE Documents and skipping indentation (advanced)
Message-Id: <1dge31f.1rv6b2d1j3ou82N@bay1-529.quincy.ziplink.net>
Tad McClellan <tadmc@flash.net> wrote:
> : print <<EOF =~ s/^\s+//;
> : this and that
>
> : this
> : and more on this
> : and more on this
> : and more on this
> : EOF
>
> : Can't modify scalar in substitution at /users/jaalto/t.pl line 21,
> : near "s/^\s+//;"
>
>
> Consider what you are asking perl to do here.
>
> What is the left side of the binding operator (=~) ?
>
> (That is, what string is to be tested against the pattern?)
>
>
> The return value from print().
That turns out not to be the case. The string being tested against the
pattern is the here-document.
print "1: ";
print <<EOF =~ m/1/;
abc
EOF
print "\n";
print "a: ";
print <<EOF =~ m/a/;
abc
EOF
print "\n";
__END__
1:
a: 1
As it happens, literal strings can't be modified in substitution, hence
the error. :-)
> What is the return value from print()?
>
> 'perlfunc' says it will return some TRUE value if it succeeds.
>
>
> So perl sees (assuming 1 for TRUE):
>
> 1 =~ s/^\s+//;
>
> So even if perl could do a substitute on a _constant_, the
> s/// wouldn't be doing what you want it to do.
No, what Perl sees is:
print ("some text" =~ s/^\s+//);
So s/// would be doing what he wants it to to do, if Perl could do a
substitution on a constant.
> But, you can use here-docs with assignment as well as with
> function calls, as above.
True.
--
_ / ' _ / - aka - rjk@coos.dartmouth.edu
( /)//)//)(//)/( Ronald J Kimball chipmunk@m-net.arbornet.org
/ http://www.ziplink.net/~rjk/
"It's funny 'cause it's true ... and vice versa."
------------------------------
Date: 4 Oct 1998 23:43:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: HERE Documents and skipping indentation (advanced)
Message-Id: <6v917v$9sv$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
:No, what Perl sees is:
:
:print ("some text" =~ s/^\s+//);
:
:So s/// would be doing what he wants it to to do, if Perl could do a
:substitution on a constant.
So don't use substitution. Use matching.
print <<EOF =~ /\S.*\n/g;
This and that
will always be
the lines I want
output for thee.
EOF
--tom
--
The software required `Windows 95 or better', so I installed Linux.
------------------------------
Date: Mon, 05 Oct 1998 03:12:21 GMT
From: nick@valueclick.com (Nick Tonkin)
Subject: Keeping a running list of the top n values retrieved
Message-Id: <3618377d.345539559@news.silcom.com>
Hi
Suppose I have a large number of variables (currently about 8,000).
For each variable I have information stored in six DBM databases. I
need to look up the information in all these databases but only for
those whose values in one of them are in the top 20 values.
Is there a standard way to keep a running list of the top 20 scoring
variables? I know I can look up the value that needs to be sorted for
each one, put them in a list and sort out the top 20, but it would be
nice to only add the variable to the list if its value is among the
current top 20.
I am guessing that what I should do is push and pop variables off a
list, but how would I avoid sorting the list for each variable so I
can compare the value with the 20th highest value?
Thx
Nick
------------------------------
Date: Sun, 4 Oct 1998 19:57:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Multi-dimensional arrays
Message-Id: <MPG.1081d57abbb8888298989e@nntp.hpl.hp.com>
In article <6v8hc9$ds0$1@news.cs.hut.fi> on 4 Oct 1998 19:13:13 GMT,
Joonas Timo Taavetti Kekoni <jkekoni@cc.hut.fi> says...
! : I'm relatively new to perl and I'd like to know if it's possible to
! : create multi-dimensional arrays......
! my @foo;
!
! for(my $t=0;$t<10;$t++)
! {
! for( my $r=0;$r<12;$r++)
! { $foo[$t][$r]=$t."X".$r;
! }
! }
Or, for one-liner mapaholics:
my @foo = map { my $t = $_; [ map "${t}X$_" => 0 .. 11 ] } 0 .. 9;
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 4 Oct 1998 21:48:07 -0400
From: "Johnathan Posey" <jposey@mindspring.com>
Subject: Need Help with Selena Sol's Web_store
Message-Id: <6v98a2$ffo$1@camel19.mindspring.com>
If anyone has any experience with installing Web_store, Please e-me.
I am having a problem with the check_setup.cgi stalling out. It isn't
returning an error message, it just gets to the part where it loads the
database_setup file and stalls.
Any help would be greatly appreciated.
Johnathan
------------------------------
Date: Sun, 4 Oct 1998 23:27:14 +0100
From: jwl@_munged_worldmusic.de (Joergen W. Lang)
Subject: Re: Newbie question about variable scope
Message-Id: <1dgedkc.3d5v4w1bwcfswN@host036-210.seicom.net>
Perless Dudek <perless@yellowkite.com> wrote:
> Thanks,
>
> My server says I have Perl5 v004_03. (Or whatever the latest perl is on
> Vservers.com) is there a new command that I should use that accomplishes
> the same thing I am trying? I am using examples in the "Perl How-To" book
> to learn Perl.
>
> Thanks much!
> Syd
>
mjd:
> >
> >This is not a variable scope problem. The problem is that your
> >version of perl is too old. Time to upgrade.
Syd,
did you try
% perl -v
?
The latest (official) version AFAIK is 5.005.
Joergen
--
To reply by email please remove _munged_ from address Thanks !
-------------------------------------------------------------------
#!/usr/bin/perl -w
print pack q,h52,,unpack q,H52,,join q,,,map chr,split q, ,,q,164 87 55
71 2 22 230 246 71 134 86 39 2 5 86 39 198 2 132 22 54 182 86 39 2 18,;
------------------------------
Date: Sun, 04 Oct 1998 19:06:21 -0700
From: Michael Griffith <webmaster@kvoa.com>
Subject: Passing Variables: $_ vs. @_
Message-Id: <3618298D.4B5C0777@kvoa.com>
I am looking at someone else's code and am wondering about how they
implemented passing variables to a subroutine.
Here is the code:
sub AddRecord{
$database=$_[0];
$returnto=$_[1];
$record =$_[2];
... Snip ...
}
Is there any difference in that implementation and this one:
sub AddRecord{
($database,$returnto,$record) = @_;
... Snip ...
}
Just wondering...
Thanks!
Mike Griffith
--
================================================
Michael Griffith Webmaster KVOA TV
griffith@kvoa.com http://kvoa.com/ Tucson, AZ
======= When the News Breaks, We Fix It. =======
------------------------------
Date: Sun, 4 Oct 1998 19:42:59 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Passing Variables: $_ vs. @_
Message-Id: <MPG.1081d210418d4fc998989d@nntp.hpl.hp.com>
[Posted to comp.lang.perl.misc and copy mailed.]
In article <3618298D.4B5C0777@kvoa.com> on Sun, 04 Oct 1998 19:06:21 -
0700, Michael Griffith <webmaster@kvoa.com> says...
...
> sub AddRecord{
> $database=$_[0];
> $returnto=$_[1];
> $record =$_[2];
...
> Is there any difference in that implementation and this one:
>
> sub AddRecord{
> ($database,$returnto,$record) = @_;
Yes. One is written on three lines, the other on just one line. :-)
Other than that they are identical.
But I'll bet that in either case the variables should be declared with
'my' to limit their scope to the subroutine body.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 05 Oct 1998 00:43:06 GMT
From: martin.oakley@usa.net (Martin Oakley)
Subject: Perlscript with WSH?
Message-Id: <3618160d.2908046@news.bne.aone.net.au>
Activeware distributes perlscript which is supported by the Microsoft
scripting engine for use with ASP and also client code on I.E.
Can this be used with Windows scripting host so that perl can be
execute as a windows process instead of a console process?
Here is the problem I am trying to solve:
I have implemented PVCS for version control of inhouse application
development. PVCS allows the use of triggers on check-in/out and
promotions. I have implemented the triggers, which compile, set
pemissions etc, using perl.
Problem: Each trigger (pre and post) fires up a console window to run
the perl interpreter. Each console window 'steals' focus, thus making
it impossible to leave the process running in the background and
continue working. In the case of a promotion, there may be 30 or more
files and this can take up to an 1/2 hour or so to complete. The
machine is virtually useless during this time.
It seems that because perlscript is registered as a scripting engine,
it should be able to be executed from wscript.exe. It does not seem to
work for me.
Is this even possible?
------------------------------
Date: 4 Oct 1998 23:10:09 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: return status of a remote shell command
Message-Id: <6v8v8h$8ed$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
"Lars Kr. Lundin" <lkl@runge.uni-c.dk> writes:
:I have a script that I run from perl on a remote machine with
:
:system('rsh remotehost myscipt.pl');
:
:where rsh is the UNIX remote shell command.
:
:I am now interested in the return status of myscript.pl.
:
:system will return the returnvalue of rsh, which is of minor interest.
:
:Can anyone tell my how I can run myscript.pl on a remote (UNIX) machine,
:and get the return status of myscript.pl into the local perl process?
Check with Maarten for something newer.
--tom
#!/bin/sh
# @(#)ersh 2.4 91/01/30 Maarten Litmaath
# This rsh front-end returns the exit status of the remote command.
# It works OK with sh/csh-compatible shells on the remote (!) side.
# If there is no remote command present, /usr/ucb/rlogin is invoked.
# Usage: see rsh(1).
#unset hostname lflag nflag user
# convex is too dumb to know unset
hostname=
lflag=
nflag=
user=
case $1 in
-l)
;;
*)
hostname=$1
shift
esac
case $1 in
-l)
lflag=-l
user=$2
shift 2
esac
case $1 in
-n)
nflag=-n
shift
esac
case $hostname in
'')
hostname=$1
shift
esac
case $# in
0)
exec /usr/ucb/rlogin $lflag ${user+"$user"} "$hostname"
esac
AWK='
NR > 1 {
print prev;
prev = $0;
prev1 = $1;
prev2 = $2;
}
NR == 1 {
prev = $0;
prev1 = $1;
prev2 = $2;
}
END {
if (prev1 ~ /[0-9]*[0-9]0/)
exit(prev1 / 10);
if (prev1 == "0")
exit(prev2);
print prev;
exit(1);
}
'
exec 3>&1
/usr/ucb/rsh "$hostname" $lflag ${user+"$user"} $nflag \
"(${*-:}); sh -c '"'echo "$0 $1" >&2'\'' $?0 "$status"' \
2>&1 >&3 3>&- | awk "$AWK" >&2 3>&-
--
I already have too much problem with people thinking the efficiency of
a perl construct is related to its length. On the other hand, I'm
perfectly capable of changing my mind next week... :-) --lwall
------------------------------
Date: Sun, 04 Oct 1998 20:31:49 -0400
From: Bill Cowan <cowanb@mindspring.com>
Subject: Re: Sites devoted to Perl Win32
Message-Id: <36181375.650474B9@mindspring.com>
Dig around www.ActiveState.com to find a list of URL for other Win32 Perl
sites. Also a searchable archive for mailing list.
Peter Kosenko wrote:
[SNIP]
> I have recently installed the Perl for Win32
> modules and they are working just fine. However,
> I am not an expert Perl programmer (not yet), and
> I am looking for Web sites that relate
> specifically to Win32 so that I can find ideas
> with which to practice.
>
-- Bill
------------------------------------------------------------------------
Metagenix, Inc: Leading the Way in Data Migration.
Web: http://www.metagenix.com/ for more datails.
Bill Cowan, bcowan@metagenix.com, Voice: 919-210-4910 Fax: 919-489-2621
Applying Perl-based toolkit and methodology to data migration process.
------------------------------
Date: Mon, 05 Oct 1998 03:25:09 GMT
From: wongksp@netvigator.com (Wong Kin Sang)
Subject: Re: What is the maining of "Bare word"
Message-Id: <36183ba4.5957266@news.netvigator.com>
On Wed, 30 Sep 1998 11:18:40 GMT, wongksp@netvigator.com (Wong Kin
Sang) wrote:
Hi,
Thanks for those who reply me previously. And here is the piece of
code that I'm struggling :
------------------------------------------------------------------------------------
use Win32::Registry;
use Socket;
#use strict;
my @local_IP;
my @PARENT_NS_IP;
my @NS_IP;
my $Register="Software\\ITV\\PNS\\Setup";
my $hkey;
sub readValuesToHash
{
local *fh = $_[0];
while ($line = <fh>)
{
@pair = split /\s+/, $line;
if ($#pair != 1) # last index number
{
print "Error line - $line\n";
}
else
{
%hash = (%hash, @pair);
}
}
return %hash;
}
open(CFG, "c:/opt/NTconfig/Swit/PNS.conf");
%h = readValuesToHash(CFG);
close(CFG);
#$PPNS=$h{\"PARENT_NS_HOST\"};
#$PHOST=$h{\"GLOBAL_NS_HOST\"};
print "HeyHey!!\n";
$x=$ENV{COMPUTERNAME};
($name,$alias,$atype, $len, @local_IP) = gethostbyname($x);
if (@local_IP != () )
{
($a,$b,$c,$d) = unpack('C4', $local_IP[0]);
}
else
{
print "Error!! \n"; <---------------------- I got error here
}
($name,$alias,$atype, $len, @PARENT_NS_IP) =
gethostbyname($h{\"GLOBAL_NS_HOST\"});
if (@PARENT_NS_IP !=())
{
($a,$b,$c,$d) =unpack('C4', $PARENT_NS_IP[0]);
}
else
{
print "Error 2!! \n";
}
($name,$alias,$atype, $len, @NS_IP) =
gethostbyname($h{\"PARENT_NS_HOST\"});
if (@NS_IP !=())
{
($a,$b,$c,$d) =unpack('C4', $NS_IP[0]);
}
else
{
print("Hahaha \n");
}
$HKEY_LOCAL_MACHINE->Open($Register, $hkey);
undef $garbage;
if (@NS_IP == @local_IP)
{
$hkey->SetValueEx("ServerName", $garbage,REG_SZ, "PPNS");
$hkey->SetValueEx("ParentNSName", $garbage,REG_SZ, "GNS");
$hkey->SetValueEx("PNSDomain", $garbage,REG_SZ,
$ENV{COMPUTERNAME});
}
else
{
$hkey->SetValueEx("ServerName", $garbage,REG_SZ, "PNS");
if (@NS_IP == @PARENT_NS_IP)
{
$hkey->SetValueEx("ParentNSName", $garbage,REG_SZ,
"GNS");
}
else
{
$hkey->SetValueEx("ParentNSName", $garbage,REG_SZ,
"PPNS");
}
#$PHOST=$PPNS;
system("nslookup $ENV{COMPUTERNAME} > tmp.txt");
open(TMP, "tmp.txt");
while (<TMP>)
{
if(/Name/)
{
($dummy, $addr) = split(" ", $_);
$hkey->SetValueEx("PNSDomain",
$garbage,REG_SZ, $addr);
}
}
system("del tmp.txt");
}
$hkey->Close();
----------------------------------------------
>Hi all of you,
>
>Recently I've got a question about wirting perl script. When I try to
>run a perl script, an error " Bare word found where operatior
>expected" has appear. What should I do/check for this ? (I've check
>that I haven't miss { ; " or wrong spelling.
>
>Thanks.
>
>Patrick
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3889
**************************************