[6870] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 495 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 18 14:04:49 1997

Date: Sun, 18 May 97 11:00:34 -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, 18 May 1997     Volume: 8 Number: 495

Today's topics:
     ? about match and rename <mhammer@execpc.com>
     Re: Can you help with a perl module? <rootbeer@teleport.com>
     Re: Executing simultaneous commands? <rootbeer@teleport.com>
     Re: for loop ? (Chipmunk)
     Re: forman and write to STDERR (Eric Bohlman)
     Re: Getting Week Number (Eric Bohlman)
     Re: Help Use 1 file to edit another (Pacific Data Resources Company)
     Re: Help Use 1 file to edit another (Pacific Data Resources Company)
     help with IO::Socket::INET ... <peterli@gdb.org>
     Re: How to replace a line of text with multiple lines? (Honza Pazdziora)
     Re: Is there a port for NT <petri.backstrom@icl.fi>
     Large Database file Hashing problem w/PERL <chuck@siege.net>
     Re: Mystery characters? <rootbeer@teleport.com>
     Re: Notice to antispammers (Nathan V. Patwardhan)
     Re: Notice to antispammers (I R A Aggie)
     Re: Output cut off <rootbeer@teleport.com>
     Re: Perl 5.003 patches? <rootbeer@teleport.com>
     Re: perl and awk (Dennis Marti)
     Re: perl and awk (Justin C Lloyd)
     Re: Q:Redirecting STDIN back to STDIN (Chipmunk)
     Re: Save Programming? (Chipmunk)
     Re: search and replace/news group bottom feeders (Eric Bohlman)
     Telnet perl script for Netware Web Server <106076.446@compuserve.com>
     Re: Telnet perl script for Netware Web Server (Nathan V. Patwardhan)
     The CGI & PERL Discussion Forum Here! (TOTO)
     Re: What's the quickest way in perl to determine if a s (Andrew M. Langmead)
     Re: Win32: Manipulating ENV with a perl script ("John Dallman")
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 18 May 1997 10:19:38 -0500
From: Mike Hammernik <mhammer@execpc.com>
Subject: ? about match and rename
Message-Id: <337F1E0A.72D4@execpc.com>

Hello

I'm attempting to match a word in 1 of 2 XtermLog files and then rename
the one with the match and then by default name the other one something
else. 
I'm using 5.002 on a HP-UX 9.05 machine.

I confess to all that I'm a newbie and this is my first program.
I've paged thru the Llama and camel as well as my Learn PERL book.
I'v also looked thru the FAQ and a collection of articles from this news
group and I can't find anything close enough to show me the LIGHT!!

I have two files   XtermLog.12345  and XtermLog.67890
inside is a a couple of blank lines and then

hudson 250
Date is Sun..........
Lots of other stuff

My code is

#!/usr/bin/perl -w

$name = getlogin;
$dir = "/users/$name";
print "$dir\n";

@file = glob('XtermLog*');
foreach (@file) { print "$_\n" };

foreach $file ( @file ) {
open (FILE, $file) || die "Could not open $file";
while (<FILE>) {
if ($_ =~ /hudson/) {
        print "$_\n";
        last;
        print "$file\n" || die "Can't print what ain't there $!";
        rename($file, "hudson") || die "No can do $!";
} else {
rename("$file", "troy");
        }
    }

}

I do create the troy file but the one that contains hudson disappears
the output and results are as follows

/users/mhammer
XtermLog.12345
XtermLog.67890
hudson 250

$ ls -l

-rwxr-xr-x   1 mhammer  group        430 May 18 07:12 sbs
-rw-rw-rw-   1 mhammer  group          19 May 18 07:13 troy

Could someone show me the error of my ways.

Small additional question.

I appreciate the time people spend to look and help someone like myself
get better at PERL. Especially when we sometimes ask dumb questions. Is
it appropriate to send a private e-mail to my mentor and thank him/her.

Thanking you in public for now.

Hammer


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

Date: Sun, 18 May 1997 09:50:54 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: mark <mark@sierra-inc.com>
Subject: Re: Can you help with a perl module?
Message-Id: <Pine.GSO.3.96.970518094331.27517E-100000@kelly.teleport.com>

On Fri, 16 May 1997, mark wrote something like:

> >$file_base = "/home/kitfox";
> >
> >use lib ("$file_base/perl");
> >
> >use crt_maze;
> 
> the path to crt_mase is literally
> 
> /home/kitfox/perl/crt_maze.pm

Okay. So you're essentially doing this:

    $file_base = "/home/kitfox";	# Set $file_base at runtime
    use lib "$file_base/perl";		# Fix @INC at compile time

Do you see the problem now? Since compile time happens before run time,
Perl is doing those two lines in the opposite order of what they look
like. Try this instead, and you may find something good happens. Hope this
helps! 

    BEGIN { $file_base = "/home/kitfox" }	# Compile time, now
    use lib "$file_base/perl";

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sun, 18 May 1997 10:16:45 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Dianne <Dianne@spamfree.com>
Subject: Re: Executing simultaneous commands?
Message-Id: <Pine.GSO.3.96.970518101557.27517K-100000@kelly.teleport.com>

On Fri, 16 May 1997, Dianne wrote:

> I was wondering if it is possible to execute a subroutine or a command
> line program and move on to the next line in the script without waiting
> for the subroutine/command to finish.  

I think you want to fork another process which can run asynchronously.
Could that be it? Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 18 May 1997 05:41:23 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: for loop ?
Message-Id: <5lm4q3$4ml$2@dartvax.dartmouth.edu>

In article <337C6922.396@mathematica-mpr.com>
the count <eglamkowski@mathematica-mpr.com> writes:

> if you want something like:
> for (; $x > 0; $x--) 
> 
> can you shorten it to:
> for ($x .. 1) 
> ?

I think the range operator .. can only count upwards.  So if $x were
greater than 1, you'd get a null array.

Chipmunk

Chipmunk


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

Date: Sun, 18 May 1997 05:19:24 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: forman and write to STDERR
Message-Id: <ebohlmanEAD2sC.Hon@netcom.com>

O'Shaughnessy Evans (shaug@callamer.com) wrote:
: I'd like to use format() and write() with STDERR, for printing out debugging
: info in a script.  If I just try to write to STDERR, I get complaints
: about "Format STDERR redefined at ./eds-bill line 113" because I'm doing
: it in more than one location in the script.  If I try to save STDERR,
: dup it, and restore it, nothing prints at all.  So, is there a "recommended"
: way to change the format for STDERR write()s?

See pp. 124-125 in the Camel book for a good description (too lengthy to 
reproduce here) of how to change formats for a filehandle on the fly.  
The issue you have actually applies to changing formats for *any* 
filehandle, because format statements are interpreted at compile time and 
are actually identified by the name following the "format" keyword.  You 
can't have two formats with the same name, since perl would have no way 
of knowing which is which.  It's just a convenience that if you don't 
make special arrangements, a format with a given name gets associated 
with the filehandle of the same name.



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

Date: Sun, 18 May 1997 05:08:25 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Getting Week Number
Message-Id: <ebohlmanEAD2A1.H1D@netcom.com>

bjorn.w.nilsson@edt.ericsson.se (BjrnNilsson) wrote:
: Hi all!

: A little thing where I just want to know if there already is a solution.
: I want to create a subfunction (or similar) that computes the week number
: given a date. I looked at the description of Steffen Beyer's Datecalc, but
: it seems to be Unix-specific and it depends upon a C-program. For sure it
: has a lot of features, but I only need the week number to run on an NT.

Use timelocal() from the Time::Local module (part of the standard 
distribution) to convert the date into a time integer and then use 
localtime() from the standard library to get the day within the year; 
divide it by seven and use int() on it to get the week number (which will 
be zero-based; add 1 if you count your weeks starting with 1).



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

Date: 18 May 1997 05:16:06 GMT
From: pdrc@best.com (Pacific Data Resources Company)
Subject: Re: Help Use 1 file to edit another
Message-Id: <5lm3am$30a$1@nntp2.ba.best.com>

Mike Hammernik (mhammer@execpc.com) wrote:
: Hello
: I would like to cat a file and use each line in that file to delete a
: line in another file. My scenario is having a file with 1744 lines. I
: want to delete lines in a file of 16000 lines that contains the first 2
: fields in file_1. The files are in a load/unload format from a db.

: file_1

: abc|1-1|abcdefghijk|abc||24|
: abc|1-3|lmnopqrstuv|abc||24|
: def|10-19|qwertyuiop|def||24|

: file_2
: abc|1-1||abc||24|
: abc|1-2||abc||24|
: abc|1-3||abc||24|
: .
: .
: .
: abc|100-19||abc||24|
: def|1-1||def||24|
: .
: .
: etc

: If i use sed as in
: for i in `cat file_1`
: do
: sed '/'"$i"'/d' file_2>>file_3
: done

: It will go through and find a match on say line 10 but it will proceed
: to go through all 16000 lines looking for another match. It simply takes
: too long to run.  Can someone help me to understand how the branch
: command is used to stop at a match and start over with the next line of
: input at the top of file_2

: I've also tried PERL but I'm not far enough in the learning curve to
: know how to read from 1 file and use the string to delete a line in
: another.

: The ultimate goal is to append file_2 back to file_1 so that I have
: 16000 lines with no duplication to reload a table with. 

: Thanks in advance

: Mike Hammernik


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

Date: 18 May 1997 05:29:26 GMT
From: pdrc@best.com (Pacific Data Resources Company)
Subject: Re: Help Use 1 file to edit another
Message-Id: <5lm43m$3oq$1@nntp2.ba.best.com>

Oops; ignore the previous response -- sticky ENTER key.


Use the "t" command in sed to cycle the input buffer only if
the previous substitute command was successful.

See the man pages for details.


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

Date: Fri, 16 May 1997 16:15:38 -0400
From: Peter Li <peterli@gdb.org>
Subject: help with IO::Socket::INET ...
Message-Id: <337CC06A.5577@gdb.org>

I am trying to compile perl5.003_99a,
and got this on "make test":

 ...
lib/io_dup........ok
lib/io_pipe.......ok
lib/io_sel........ok
lib/io_sock.......Resource temporarily unavailable at ./lib/io_sock.t
line 29.
FAILED on test 1
lib/io_taint......ok
lib/io_tell.......ok
lib/io_udp........Can't call method "sockname" without a package or
object reference at ./lib/io_udp.t line 35.
FAILED on test 2
lib/io_xs.........ok
 ...

Somehow, perl isn't processing the IO::Socket::INET
methods correctly (I think). Anyone have a solution to
this ?

Thanks in advance,
Peter Li
email: peterli@gdb.org


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

Date: Sun, 18 May 1997 15:11:12 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: How to replace a line of text with multiple lines?
Message-Id: <adelton.863968272@aisa.fi.muni.cz>

graeme@manawatu.gen.nz (Graeme Merrall) writes:

> Hi.
> I'm trying to achieve a locally scripted type of SSI thing (if that
> makes sense). Basically, my script parses a file looking for comments
> and then inserts the right thing at the approriate place like a footer
> for instance. I want to do this locally without using SSI's on a web
> server.
> 
> What I did was slurp the text I want inserted into an array and try
> and replace the file but no go for some reason.
> 
> Here's some potted code. It's looking for $HEADER in the html file
> 
> open (MYFILE, header.txt);
> @header = <MYFILE>;
> close MYFILE;
> 
> and then open the file I want replaced and...
> open (BASEFILE, +< base.html);

My Perl will not parse this -> "+< base.html";

> $insertline = <BASEFILE>;
> while ($insertline ne "") {
>   if ($insertline =~ /\$HEADER/) {
>     $insertline =~ s/$insertline/@header/;

What does this say to you? I am getting Literal @header now requires
backslash error message. You can use substitute only for scalars. So
on the right side there must be either a string or a number. You can
either do $rightside = join '', @header; and then
s/$insertline/$rightside/; or use the fact that Perl is able to
interpolate the array for you "@header". Here you should also set up
the value of $" variable;

>      $insertline = <BASEFILE>
>   }
> }

Hope this helps.

--
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Sun, 18 May 1997 17:25:46 +0200
From: Petri Backstrom <petri.backstrom@icl.fi>
Subject: Re: Is there a port for NT
Message-Id: <337F1F7A.75BD@icl.fi>

Jay Allen wrote:
> 
> Saving Petri the work....:      ;)

Thanks. :-)

 ...petri.backstrom@icl.fi
    ICL Data Oy
    Finland


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

Date: 18 May 1997 08:41:05 GMT
From: "Chuck McCollum" <chuck@siege.net>
Subject: Large Database file Hashing problem w/PERL
Message-Id: <01bc632e$31a873e0$515881d0@longbow.siege.net>

Can anyone out there help with this?  I have a large (50 meg and growing)
database (BTree fromat) that I made with perl. I would like to do some kind
of FIND or DOM read (for those of you who know BASIC) to the key where I
would like to start reading from, then read sequentially from there. The
problem is doing this WITHOUT the 'keys %hash' function that creates a very
large process.

 I can use the 'each' function and bypass records but that would be too
slow.  Is there some way I can use pattern matching as a filter with the
'keys' function without slurping up that large array? Do I need to EXTEND
perl? Should I abandon the BTree dbm and create another file type? I've
researched this problem and came up dry. It seems that perl has no
equivalent of a DOM type of read.....am I correct?

Any help would be very appreciated!

Please respond to chuck@siege.net

and to:

Andy Burgess wsite@website-plus.com


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

Date: Sun, 18 May 1997 10:02:28 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: mikane@best.com
Subject: Re: Mystery characters?
Message-Id: <Pine.GSO.3.96.970518095331.27517G-100000@kelly.teleport.com>

On 16 May 1997 mikane@best.com wrote:

> Is there a way to view or print all hidden characters?

    $astring = "    foo\abar\r";
    $bstring = "\tfoo\fbar\n";
    print "\$astring is $astring\n";
    print "\$bstring is $bstring\n";
    print "\nLet's try that again...\n\n";
    print "\$astring is [", unpack("H*", $astring), "]\n";
    print "\$bstring is [", unpack("H*", $bstring), "]\n";

Of course, you can print just a substring, or you could put spaces in
periodically, but this is really just for debugging. Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 18 May 1997 15:30:00 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Notice to antispammers
Message-Id: <5ln79o$g4a@fridge-nf0.shore.net>

Wolfgang Schelongowski (skaranyi@LOCALHOST.ruhr.de) wrote:

: Harass the spammers, do not defend people aiding the spammers to harass.

A day late and a dollar short you are.  Tom's already gone, as are many
of the other people who were engaged in this discussion.  If you really
look at the point of Tom's exercise, you should conclude that he was
trying to prove how simple it is / would be for spam harvesters to un-
munge a From header, and thus send a person spam.

: By sending unsolicited bulk email to any of my accounts you give me 
: permission to nuke any of your computers. Ports 135/139 are known.

Tisk tisk.  Now that's not nice.  Does your provider know about this?
Regardless of your motives, I doubt they'd approve.

Hey, wait a minute ... I killfiled this thread because I couldn't take
it anymore.  Ok, something happened - I'm killfiling it again.  You can
argue with me if you wish, but I won't be reading it.  Thanks.  :-)

--
Nathan V. Patwardhan
nvp@shore.net


--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Sun, 18 May 1997 10:43:16 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: Notice to antispammers
Message-Id: <fl_aggie-ya02408000R1805971043160001@news.fsu.edu>

In article <5ll2e8$oil@xivic.ruhr.de>, skaranyi@LOCALHOST.ruhr.de (Wolfgang
Schelongowski) wrote:

+ You might have heard that Tom sometimes visits Europe. Some countries
+ who sufferred under the Nazis take a dim view of people making such
+ lists. Would you love to see Tom arrested?

I would like to see you try...

James - at which point, I would say that you *definitely* have too much
        time on your hands...

-- 
Consulting Minister for Consultants, DNRC
Support the anti-Spam amendment <url:http://www.cauce.org/>
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/perl/faq/idiots-guide.html>


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

Date: Sun, 18 May 1997 10:17:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Ryan Huebsch <compman@pb.net>
Subject: Re: Output cut off
Message-Id: <Pine.GSO.3.96.970518101718.27517L-100000@kelly.teleport.com>

On Fri, 16 May 1997, Ryan Huebsch wrote:

> 	open(mediaFile,$mfile);# || &documentFileError;
> 	print "Content-type: image/"."gif"."\n\n";
> 	while(<mediaFile>)
> 	{
> 		print $_;
> 	}
> 	close(mediaFile);
> }
> 
> on my Windows NT Server running Perl 4.00 and Perl 5.003 (both don't work)
> the output is not complete. It stops at 13K... Is there any reason for
> this?  The exact same script was placed on a Solaris 2.3 system and worked
> perfectly.

Maybe you need binmode(). Hope this helps!

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: Sun, 18 May 1997 10:08:01 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Steve Nelson <senelson@negentropy.com>
Subject: Re: Perl 5.003 patches?
Message-Id: <Pine.GSO.3.96.970518100511.27517H-100000@kelly.teleport.com>

On Fri, 16 May 1997, Steve Nelson wrote:

> I'm trying to upgrade our Perl from 5.003 Patchlevel 0 to Patchlevel 2,
> in order to use sfio.  

But that patchlevel is known to have some ugly bugs!

> My sysadmin doesn't want us to upgrade all the way to the Perl 5.004
> beta quite yet, and wants the minimal number of patches applied to use
> sfio. 

The 5.004 beta is much more stable than 5.003_02, IMHO.

> Unfortunately, I can't find patches 1 and 2 to perl5.003 anywhere,
> including CPAN.  Can anyone tell me where to find these? 

I think they've been lost in the mysteries of time. But if you can wait
just a few hours more, (or a few dozen hours) the 5.004 release
announcement may come out. It's _that_ close. Hang in there! :-) 

-- Tom Phoenix        http://www.teleport.com/~rootbeer/
rootbeer@teleport.com   PGP  Skribu al mi per Esperanto!
Randal Schwartz Case:     http://www.lightlink.com/fors/



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

Date: 18 May 1997 15:52:35 GMT
From: marti@netrail.net (Dennis Marti)
Subject: Re: perl and awk
Message-Id: <5ln8k4$jo7$1@skipper.netrail.net>

Allon Henig (ahenig@iil.intel.com) wrote:

: system (" awk '{FS=".";print $2}' filename    ");
: 
: this of course causes an error because of too much "" . Do you have any
: suggestions how to overcome this problem ?

Don't use awk (in this case). Try something like:

    open FILE, filename or die $!;
    print +(split /\./)[1], "\n" while <FILE>;

I hope this helps.

Dennis Marti


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

Date: 18 May 1997 16:50:42 GMT
From: lloyd@cs.fsu.edu (Justin C Lloyd)
Subject: Re: perl and awk
Message-Id: <5lnc12$crc$1@news.fsu.edu>

Dennis Marti (marti@netrail.net) wrote:
: 
:     open FILE, filename or die $!;
:     print +(split /\./)[1], "\n" while <FILE>;

Or how about

open FP, $filename or die "$filename: $!\n";
print join "\n", map { (split '\.')[1] } <FP>;


JcL

-- 
Justin C. Lloyd ______________________________________________________________
Graduate Teaching Assistant                phone: 904/644-0559
Department of Computer Science             email: lloyd@cs.fsu.edu
Florida State University                   www:   http://www.cs.fsu.edu/~lloyd

                               P + L = :)


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

Date: 18 May 1997 05:47:08 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Q:Redirecting STDIN back to STDIN
Message-Id: <5lm54s$4ml$3@dartvax.dartmouth.edu>

In article <337B3402.996@bnr.ca>
Adam Reeves <areeves@bnr.ca> writes:

> This may sound like a dumb question, but...
> 
> After doing the following statements:
> 
> open(STDIN,  "<&Client") or die;
> open(STDOUT, ">&Client") or die;
> 
> How do you redirect STDIN back to STDIN
> and, likewise, STDOUT back to STDOUT?

This may seem like a dumb question too...

Why would you want to do that?

Chipmunk


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

Date: 18 May 1997 05:38:52 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Save Programming?
Message-Id: <5lm4lc$4ml$1@dartvax.dartmouth.edu>

In article <337C6AA0.69A1@informatik.tu-muenchen.de>
Alex `Taker` Pircher <pircher@informatik.tu-muenchen.de> writes:

> And is there a easy way to remove nearly all special characters, so
> that the $file contains only: A-Z a-z / _ -

$file =~ tr#\-_/A-Za-z##cd;

That deletes every character in $file that isn't in - _ / A-Z a-z.

Chipmunk


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

Date: Sun, 18 May 1997 06:14:49 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: search and replace/news group bottom feeders
Message-Id: <ebohlmanEAD5Cp.KK9@netcom.com>

Hans Gilde (hansg@escape.com) wrote:

: I feel that there is no form of life lower than those who scour the news
: groups for newbies to sell their consulting services to.  Never have I
: seen so many of these bottom feeders as in comp.lang.perl.misc.  I
: revieved SEVEN emails offering consulting services since I am posting
: from a new email account.  I recognize the need for consulting firms to
: advertise, but some of the emails that I recieved hinted or indicated
: that it would be impossible to do what I was looking for without years
: of training in PERL.  What BS!  The sprit of sharing code and helping
: other, including new, programmers is lost to these people.  Well, that's
: my rant.

I didn't see your original post, so one question: you didn't, by any 
chance, end your post with something equivalent to "please e-mail me 
because I don't read this group regularly," did you?  If so, a lot of 
people would sarcastically offer to sell their services to you, because 
it comes off sounding like "please do my homework for me."

If that wasn't the case, then your complaint is quite legitimate, and 
falls into the general category of Unsolicited Commercial Email (UCE); 
the proper place to discuss ways of avoiding this is 
news.admin.net-abuse.email.



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

Date: Sun, 18 May 1997 06:45:28 -0700
From: Tim Coates <106076.446@compuserve.com>
Subject: Telnet perl script for Netware Web Server
Message-Id: <337F07F8.3F78@compuserve.com>

I want to get a Netware Web Server v2.5 to do a telnet behind the scenes, 
log into a machine, get some data and disconnect, then show that data in 
the user's browser. I get errors with the samples I have seen from
use Sockets;
&AF_INET
and a few more things.
In the documentation, socket is supported by this perl interpreter, any 
suggestions?


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

Date: 18 May 1997 05:42:29 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Telnet perl script for Netware Web Server
Message-Id: <5lm4s5$qk3@fridge-nf0.shore.net>

Tim Coates (106076.446@compuserve.com) wrote:

: In the documentation, socket is supported by this perl interpreter, any 
: suggestions?

Why not use the Net::Telnet module?  I have no idea if this works on
NT/95, but I've had success with Linux/FreeBSD/SUNOS4/Solaris.

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Sun, 18 May 1997 16:15:18 GMT
From: nospam@this.address (TOTO)
Subject: The CGI & PERL Discussion Forum Here!
Message-Id: <3382296c.364915@news.enterprise.net>

Hi,

For any questions regarding CGI & PERL, why not post them at the 
CGI discussion forum as well as USENET? 

http://www.bitsmart.com/sas

You may well increase the chances of your questions being answered.

Please pass the word around and lets see if we can all help each
other.
		
Regards


Toto
sas@bitsmart.com
http://www.bitsmart.com/sas  -  The way to the CGI discussion forum



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

Date: Sun, 18 May 1997 13:51:12 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: What's the quickest way in perl to determine if a scalar is a list?
Message-Id: <EADqHD.FC1@world.std.com>

[A copy of this article was e-mailed to the author of the referenced article]

Paul, in what way do you think your following code examples are better
than the answer in the FAQ document?
<http://www.perl.com/CPAN/doc/manual/html/pod/perlfaq4/How_can_I_tel_whether_an_aray_.html>

Besides, #1 could be an average of 50% faster if you put a "last"
statement inside the "if". (Also a but faster if you said foreach
(@array). Array lookups are a little expensive, the implicit
referencing done by foreach is cheap.)  Also, it would be faster if
you put the /o modifier on the regular expression match.

#2 has a bug. "hi there" as a search string will match if "hi" and
"there" are consecutive elements of the array. (And don't try to fix
it by changing the separater characters. Any separater you change to,
I can change $string to match it.)

#3 has a bug. The syntax of grep in "grep EXPR, LIST", not "grep RE,
LIST". The expression "$string" will either always be true (if $string
contains a boolean true value), or always false. It also could use
help from the /o modifier.

All of your solutions have the bug that occurs when $string contains
regular expression metacharacters.

Paul Lussier <plussier@synnet.com> writes:

>> I would really like to have the exists function work on arrays as well.

>	foreach $element (0..$#array){
>	  if ($array[$element] =~ /$string/) {
>	    print "found it in \$array[$element]\n";
>	  }
>	}

>Or, alternatively:

>	print "found it\n" if (join (' ', @array) =~ /$string/);

>Or even:

>	print "found it\n" if (grep ($string, @array));

>I think the grep is the most efficient of these 3 methods.  There are probably 
>several other ways to do this, and I'm sure browsing the man pages would reveal
>them all.  But I leave that as an excercise for the reader :)
-- 
Andrew Langmead


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

Date: Sun, 18 May 1997 15:42:55 GMT
From: jgd@cix.compulink.co.uk ("John Dallman")
Subject: Re: Win32: Manipulating ENV with a perl script
Message-Id: <EADvnJ.Kn5@cix.compulink.co.uk>

In article <337C85EC.9EC4A512@software.com>, morgan.stair@software.com 
(Morgan Stair) wrote:

> I'd like to write a perl command line utility to manipulate my
> environment variables on a WindowsNT system (i.e. I'm using the Win32
> port).

The way I do this is to use the pl2bat.pl wrapper-generator to wrap the 
perl in a .bat file, then edit the .bat file to call another .bat file 
that I write during the course of the Perl script. This is crude, but 
workable.

--- 
John Dallman, jgd@cix.co.uk. A micro-FAQ on things I keep getting asked: 
#!perl is at ftp://.../CPAN/ports/msdos/tips-tricks/hbp_403.zip, Perl for 
NT/Win 95 can be found at http://www.activeware.com, with an excellent FAQ 
file at http://www.endcontsw.com/people/evangelo/Perl_for_Win32_FAQ.html 
and no, I don't have the slightest idea what's wrong with your CGI script. 
Try http://www.perl.com/perl/faq/idiots-guide.html


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

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

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