[10903] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4504 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Dec 28 06:07:36 1998

Date: Mon, 28 Dec 98 03: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           Mon, 28 Dec 1998     Volume: 8 Number: 4504

Today's topics:
    Re: Boolean search facility <ebohlman@netcom.com>
    Re: Can I force Perl to run C Shell (or tcsh) ?CGI? <bb@jesusfish.xmission.com>
        Can not get perlcc to work in Win95 (David Lees)
        COM port and Perl <slava@homestudio.rosprint.ru>
    Re: COM port and Perl (John Stanley)
        filehandle question <kwang@kwang.org>
    Re: filehandle question (Sam Holden)
    Re: filehandle question <rick.delaney@home.com>
        How do I...... <dusty@hofffmain.com>
    Re: How do I...... (John Stanley)
        Improve speed of a perl-script <beekmans@iae.nl>
    Re: Improve speed of a perl-script (Fluffy)
    Re: need help (Tad McClellan)
    Re: newbie <jmaas@execpc.com>
    Re: newbie (Tad McClellan)
    Re: Pacman anyone? (Tad McClellan)
    Re: problem with specific language characters ("=?iso-8 <off-duty@entheosengineering.com>
    Re: Problem writing a file from web browser <chatmaster@c-zone.net>
    Re: Retrospective on comp.lang.perl.moderated? (Tad McClellan)
    Re: searching for pattern in a file (Sam Holden)
        Sending mail to multiple addresses <john_z@hotmail.com>
    Re: Sending mail to multiple addresses (Groovy94)
        Syntactical weirdness? Or is it just me? <bb@jesusfish.xmission.com>
    Re: Syntactical weirdness? Or is it just me? (Sam Holden)
    Re: Syntactical weirdness? Or is it just me? (Fluffy)
    Re: Syntactical weirdness? Or is it just me? <ebohlman@netcom.com>
        Usual "Hello, world" problem (Gregg Silk)
    Re: Usual "Hello, world" problem (Mike Schechter)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Mon, 28 Dec 1998 10:18:52 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Boolean search facility
Message-Id: <ebohlmanF4o7BG.2D6@netcom.com>

Randy Kobes <randy@theory.uwinnipeg.ca> wrote:
: On Sat, 26 Dec 1998 14:02:43 -0500, 
: 	Steven Barbash <stevenba@ccpl.carr.org> wrote:
: >
: >Is there a package or module or extension or software or link to software 
: >or ...
: >which does a boolean search?
: >more specifically, not limited to AND and OR and NOT, but doing NEAR?

: Hi,
:    Eric Bohlman posted a while ago a couple of modules that do
: boolean searches - you can get these from
: 	http://members.xoom.com/omsdev/ebohlman/perlmodules/

Version 0.02 of Text::Query::Advanced and Text::Query::Simple were posted 
there a couple minutes ago.  If 'near' means 'physical proximity' the 
Advanced module should do what you want; if it means 'fuzzy string match' 
then feel free to extend the module :)  (it *does* allow Perl regexps in 
search expressions).



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

Date: Mon, 28 Dec 1998 03:32:11 -0700
From: "Brandon Burt" <bb@jesusfish.xmission.com>
Subject: Re: Can I force Perl to run C Shell (or tcsh) ?CGI?
Message-Id: <767n70$g9l$1@news.xmission.com>

Mark-Jason Dominus wrote in message <741o3u$eic$1@monet.op.net>...

>>The question is can I force Perl
>
>Force is never the answer.

Can he cosset?

-Brandon Burt




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

Date: Mon, 28 Dec 1998 05:57:52 GMT
From: debl@world.std.com (David Lees)
Subject: Can not get perlcc to work in Win95
Message-Id: <F4nv8G.GIM@world.std.com>


I am a total perl newbie.  Just downloaded the ActiveState version and am
having not trouble with the interpreter on my initial simple Hello world
type code.  I tried to compile with perlcc under Win95 and am unable to
get it to work.  A C program seems to get generated, but the perlcc batch
file bombs out with an error message that it can not open !

Anyone know if the perlcc.bat script works properly under Win95 and if so,
what I could be messing up?

Thanks in advance.

David Lees
debl@world.std.com




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

Date: Mon, 28 Dec 1998 11:51:16 +0300
From: "Slava" <slava@homestudio.rosprint.ru>
Subject: COM port and Perl
Message-Id: <36874682.0@news.global-one.ru>

Hi  !!!

Can you answer me what perl module I must use for the work with com port
(cua0/COM1/ttyS0, etc) ???

Best regards,
Slava.






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

Date: 28 Dec 1998 09:26:53 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: COM port and Perl
Message-Id: <767ist$of5$1@news.NERO.NET>

Comp.lang.perl removed from followup: invalid group
comp.lang.perl.modules removed from followup: posting to both .misc
	and .modules is self-contradictory.

In article <36874682.0@news.global-one.ru>,
Slava <slava@homestudio.rosprint.ru> wrote:
>Can you answer me what perl module I must use for the work with com port
>(cua0/COM1/ttyS0, etc) ???

None.



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

Date: Sun, 27 Dec 1998 22:20:12 -0600
From: Kent Wang <kwang@kwang.org>
Subject: filehandle question
Message-Id: <368706F9.16A3C408@kwang.org>

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
how can i redirect STDERR (or any other filehandle, for that matter) to
STDOUT?</html>



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

Date: 28 Dec 1998 04:37:34 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: filehandle question
Message-Id: <slrn78e2oe.2n.sholden@pgrad.cs.usyd.edu.au>

On Sun, 27 Dec 1998 22:20:12 -0600, Kent Wang <kwang@kwang.org> wrote:
><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
><html>
>how can i redirect STDERR (or any other filehandle, for that matter) to
>STDOUT?</html>

perlfaq5 : How do I dup() a filehandle in Perl?

It would be appreciated if you would not past in HTML - by me anyway.

-- 
Sam

Can you sum up plan 9 in layman's terms? It does everything Unix does
only less reliably.
	--Ken Thompson


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

Date: Mon, 28 Dec 1998 04:45:33 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: filehandle question
Message-Id: <36870EBA.60BA43BD@home.com>

[posted & mailed]

Kent Wang wrote:
> 
> how can i redirect STDERR (or any other filehandle, for that matter)
> to STDOUT?

perldoc -f open

An excerpt:

    Here is a script that saves, redirects, and restores STDOUT and 
    STDERR: 

         #!/usr/bin/perl
         open(SAVEOUT, ">&STDOUT");
         open(SAVEERR, ">&STDERR");

         open(STDOUT, ">foo.out") || die "Can't redirect stdout";
         open(STDERR, ">&STDOUT") || die "Can't dup stdout";

         select(STDERR); $| = 1;     # make unbuffered
         select(STDOUT); $| = 1;     # make unbuffered

         print STDOUT "stdout 1\n";  # this works for
         print STDERR "stderr 1\n";  # subprocesses too

         close(STDOUT);
         close(STDERR);

         open(STDOUT, ">&SAVEOUT");
         open(STDERR, ">&SAVEERR");

         print STDOUT "stdout 2\n";
         print STDERR "stderr 2\n";

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Mon, 28 Dec 1998 22:51:24 +1100
From: "Cool" <dusty@hofffmain.com>
Subject: How do I......
Message-Id: <767f6q$s3l$1@reader1.reader.news.ozemail.net>

I have text sitting in file.

What I need to do is delete everything before a certain word. i.e

The world is a happening place.

and I needed to delete everything before "place", how would I go about this.

The words before it are always changing so I cant use something like:

$name =~  s/The world is a happening//;


I've looked in the FAQ, but either Im dumb or stupid because I am sure there
is a simple solution to it.

Also could someone tell me if there is a good place on the web that tells
you about things like

$name =~ s/something/somethingelse/g;
$name =~ tr/something/somethingelse;

and similar things as above. I know the FAQ has some stuff, just wondering
if there were other places that might have info on it.

Thanks a heap in advance,

David Branston.
gxd@spamproof.bigpond.com





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

Date: 28 Dec 1998 08:52:42 GMT
From: stanley@skyking.OCE.ORST.EDU (John Stanley)
Subject: Re: How do I......
Message-Id: <767gsq$o08$1@news.NERO.NET>

In article <767f6q$s3l$1@reader1.reader.news.ozemail.net>,
Cool <dusty@hofffmain.com> wrote:
>I have text sitting in file.
>
>What I need to do is delete everything before a certain word. i.e
>
>The world is a happening place.
>
>and I needed to delete everything before "place", how would I go about this.

vi text.file
/place
:1,.d
:wq



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

Date: Mon, 28 Dec 1998 09:44:32 +0100
From: Marcel Beekmans <beekmans@iae.nl>
Subject: Improve speed of a perl-script
Message-Id: <368744EF.703FD54@iae.nl>

I'm building an application for the web. It is a very big appliction, it
is about 10,000 code-lines. The speed of the appliction is really bad.
What can I do?
(It is not  impossible to cut the file into 2 or more separate files).




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

Date: 28 Dec 1998 09:52:30 GMT
From: meowing@banet.net (Fluffy)
Subject: Re: Improve speed of a perl-script
Message-Id: <767kcp$d3@meow.invalid>

Marcel Beekmans <beekmans@iae.nl> wrote:
> I'm building an application for the web. It is a very big appliction, it
> is about 10,000 code-lines. The speed of the appliction is really bad.
> What can I do?

Um, rewrite the slow parts so they're faster?  You could have
anything from one really inefficient loop to, well, a whole lot of
inefficient things going on in there.

To help find the slow parts, take a look at these:

perldoc Benchmark
perldoc -f times
-- 
"FEAST!"
      --Alice


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

Date: Sun, 27 Dec 1998 23:43:07 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: need help
Message-Id: <bp5767.b3l.ln@magna.metronet.com>

Ian Falcone (iflynx@blazenet.net) wrote:
: Hi all,

1) Please don't post the same article multiple times with 
   different subjects.

   It does not improve your chances of getting responses. 

   It *decreases* your chances.



2) Please put the subject of your article in the Subject header.

   That is the purpose of the Subject header.

   Nearly every post here "needs help".


      Subject: best way to learn Perl

   would have been much better (many knowledgeable folks will skip
   reading articles whose subject cannot be discerned from the Subject)



3) From the above observations, it is apparent that you are also
   new to Usenet newsgroups.

   You should read some of the articles in

      news.announce.newusers

   if you want to get the most from Usenet.



Enough on good manners, now on to the question at hand...



: I am interested in learning how to program with Perl, but I have no
: experience with programming at all. 


   There have been several recent threads about whether Perl is
   a good "First Programming Language".

   See if you can find them at    www.dejanews.com

   I think the consensus is that Perl is not good for a first
   language.

   A F-1 Formula car is not a good car for learning to drive, though
   it is extremely effective for driving once mastered.

   Perl has a lot of "short cuts" in it where experienced programmers
   realize what is being cut out. New folks may be mystified by them.



: I bought a book on the Internet called
: Perl5 for Dummies and read the first 5 chapters so far and this really is
: fascinating to me.  


   See if you can sell it to a Dummie, and then use the money to
   buy "Learning Perl" instead.

   If you can't sell it, then just buy "Learning Perl" anyway  ;-)

   (There are reviews of Perl books at    http://www.perl.com )



: I am interested in some feedback from more experienced
: Perl people who can lead me in the right direction.  If anyone has any
: helpful recommendations as far as what is the best way to learn Perl, I am
: all ears.



   The best way to learn Perl is to learn programming elsewhere first.

   Many Community Colleges offer introductory programming classes
   (often using Pascal or C) for a reasonable price.




   OTOH, many people manage to pick up programming by just messing
   around with Perl, as it has many ways to do any particular
   thing, and you only have to be able to find one of them to
   get the results you need   ;-)

   If you want to be a "Hobbyist Programmer", just get Learning Perl
   and start writing programs.

   If you want to be a "Professional Programmer", learning fundamental
   programming concepts with another language will likely be more
   effective (eg. Pascal was *designed* as a language for learning
   programming, and is therefore well suited to learning programming)



   Good luck!


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 27 Dec 1998 22:21:47 -0600
From: John Maas <jmaas@execpc.com>
Subject: Re: newbie
Message-Id: <76710a$63g@newsops.execpc.com>

I find myself wondering if you know HTML? If not perhaps you should start
there. The way to learn programming is by programming. Perl is a good
language, but if you try to learn it as an initial computer language, you will
have the problem that it is used by web folk mainly in the CGI. If you write
Perl programs for that purpose, you will have the additional conceptual
problems of running a program on somebody else's computer where your control
is a lot less.

In general, if you do want to learn Perl, start by downloading the ActivePerl
just like they tell you in the Dummie's book and start by writing programs
that run on you little home computer. Otherwise I think you will be in over
your head. Buy the way, Perl really is an excellent language. You might also
consider going to www.perl.com and before too long, the O'Reilly book,
Learning Perl.

    -John

Ian Falcone wrote:

> Hi all,
> I am interested in learning how to program with Perl, but I have no
> experience with programming at all. I bought a book on the Internet called
> Perl5 for Dummies and read the first 5 chapters so far and this really is
> fascinating to me.  I am interested in some feedback from more experienced
> Perl people who can lead me in the right direction.  If anyone has any
> helpful recommendations as far as what is the best way to learn Perl, I am
> all ears.
> Thanks,
> Ian F.





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

Date: Sun, 27 Dec 1998 23:16:00 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: newbie
Message-Id: <g64767.70l.ln@magna.metronet.com>

John Maas (jmaas@execpc.com) wrote:

: I find myself wondering if you know HTML? 


   I find myself wondering why you think HTML has anything to
   do with Perl.

   Most Perl programs don't do WWW stuff at all. 

   So you can certainly do plenty with Perl without knowing any HTML
   (as was done during the years that Perl was in use before 
    HTML was even invented...)


: If not perhaps you should start
: there. 


   I advice Ian to not follow that advice.

   You should start to learn Perl by writing small and simple
   programs.


: The way to learn programming is by programming. 


   HTML is not programming.

   HTML is a markup language, not a programming language.


: Perl is a good
: language, but if you try to learn it as an initial computer language, you will
: have the problem that it is used by web folk mainly in the CGI. 


   How is "used by web folk mainly in the CGI" a problem in learning
   to program in Perl?

   You only need to know HTML if you plan to use Perl for CGI
   programming.

   Perl is a general purpose programming language, suitable for
   many common tasks.

   CGI programming is just one of them.


: If you write
: Perl programs for that purpose, you will have the additional conceptual
: problems of running a program on somebody else's computer where your control
: is a lot less.


   He didn't say what his purpose is.

   He didn't even mention CGI.

   Perl does not equal CGI.


: In general, if you do want to learn Perl, start by downloading the ActivePerl
: just like they tell you in the Dummie's book 


   He didn't say what "operating system" he uses either.

   Start by downloading a perl that will run on whatever computer
   you have at hand.


: and start by writing programs
: that run on you little home computer. Otherwise I think you will be in over
: your head. 


   This is very good advice indeed.


: Buy the way, 


   The Way is free  ;-)


: Perl really is an excellent language. You might also
: consider going to www.perl.com and before too long, the O'Reilly book,
: Learning Perl.


   There is the best advice in the whole post, get one of the
   "Learning Perl" books and take it from there.



: Ian Falcone wrote:

: > Hi all,
: > I am interested in learning how to program with Perl, but I have no
: > experience with programming at all. I bought a book on the Internet called
: > Perl5 for Dummies and read the first 5 chapters so far and this really is
: > fascinating to me.  I am interested in some feedback from more experienced
: > Perl people who can lead me in the right direction.  If anyone has any
: > helpful recommendations as far as what is the best way to learn Perl, I am
: > all ears.



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 27 Dec 1998 22:39:26 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Pacman anyone?
Message-Id: <u12767.etk.ln@magna.metronet.com>

Jonathan Stowe (gellyfish@btinternet.com) wrote:
: On Sun, 27 Dec 1998 17:40:24 -0600 Scott Allen Zsori <zsoris@post.uwstout.edu> wrote:
: >                  Has anyone else ever actually used a programming
                                ^^^^
: > command in a non-programming sentence (I greped a friend's last sentence
: > by accident once :)?  

: Yeah I use 'use','require','do','for','if','else','map','sort','while',
: 'until','unless' all the time :)
                           ^^^^

   and time()


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Sun, 27 Dec 1998 18:28:43 -0600
From: Rich Grise <off-duty@entheosengineering.com>
To: Martin Schager <martin.schager@vienna.at>
Subject: Re: problem with specific language characters ("=?iso-8859-1?Q?=F6?=, =?iso-8859-1?Q?=E4?=,=?iso-8859-1?Q?=FC?=,=?iso-8859-1?Q?=DF?=")
Message-Id: <3686D0BB.6C12D6D5@entheosengineering.com>

Martin Schager wrote:
> =

> If someone submits information via a form, that contains =F6,=E4,=FC,=DF=
, I get
> strange %something instead of these characters, when I process the form=
=2E
> Is there any solution to this problem?

@INPUT =3D split(/&/,$input);
foreach $namevalue (@INPUT) {
    ($name, $value) =3D split(/=3D/, $namevalue);
    $name =3D~ tr/+/ /;
    $value =3D~ tr/+/ /;
    $name =3D~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =3D~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} =3D $value;
}

Thanks to Matt for that one. (I think it's also in cgilib.pl).
-- =

Rich Grise
off-duty@entheosengineering.com
(No need to futz with my e-mail: I have a "delete" button!)


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

Date: Sun, 27 Dec 1998 22:28:14 -0800
From: TRG Software <chatmaster@c-zone.net>
Subject: Re: Problem writing a file from web browser
Message-Id: <368724FE.83B889C5@c-zone.net>

Scott Allen Zsori wrote:
> 
> Jason Swett wrote:
> 
> > Rookie here.  On a Unix server, I can run a CGI script via telnet that
> > re-writes a little test file.  This won't work when run from a browser.
> >
> > Is there something special that needs to be done to give the browser user
> > permissions to re-write the file?
> >
> > I've used CHMOD to give RWX access to the test file, but that doesn't sem to
> > cut it.
> >
> > Any ideas?  Thanks.
> 
> I'm note really sure how to fix it, but I might know the problem. When you run a
> script from the command prompt, it's running under your username. Therefore only
> you need permissions to this file. On the other hand, when running from a web
> browser, it's running under a different name (possibly that of nobody:nobody),
> so the file needs permissions for whatever the server is running as. The
> directory it's in might need different permissions as well. I know this is all
> cryptic, but I haven't done much on Unix. Someone just kick me if I'm wrong.
> Thanks. :)
> 
> hth,
> Scott Zsori
Actually, he said it worked via Telnet, only not the browser. Therefore,
I can only assume there's nothing wrong with the script, well, not
entirely. But he needs to learn how to write a script to work with a
browser. Of course, that's not to say that's the problem at hand. But
most likely it is, from what he said. Well, that's what I got from it.
:-)
--
Regards,
Tim Greer - chatmaster@c-zone.net
TRG Software and The Link Worm
http://www.linkworm.com
The Chat Base
http://www.chatbase.com
-----------------------------------------------------------------------
* Creator of Paradise Chat, Chat Central & Spiral Chat
* Receiving over 250,000+ hits a day from users Worldwide!!!
* Sales of custom chat server scripts * CGI/Perl scripting
* Script trouble shooting/security * Modify & debug scripts
* Freelance Perl Scripting for any purpose or application


       Copyright ) 1998 TRG Software and The Link Worm.


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

Date: Sun, 27 Dec 1998 22:33:58 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Retrospective on comp.lang.perl.moderated?
Message-Id: <mn1767.etk.ln@magna.metronet.com>

Leslie Mikesell (les@MCS.COM) wrote:

: After a few months I tried to answer something
: and was put off by the automated rejection.


comp.lang.perl.moderated doesn't _have_ automated rejections.

If you got a rejection, it was written by a human.


There is an automated registration process however.

It that what put you off?



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 28 Dec 1998 04:21:10 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: searching for pattern in a file
Message-Id: <slrn78e1pl.sqk.sholden@pgrad.cs.usyd.edu.au>

On Sun, 27 Dec 1998 21:01:09 -0600, AJ <ajonsson@csi.com> wrote:
>Use Perl's "grep" function, substring out the number of characters you need
>and then cat the result using the "." operator.
>quick and sloppy, I make no excuse for errors or inelegence:

Well don't make errors then and test you code before you post it to be
archived for others to 'learn' from...

>@this = [TheStringThatHasMyData];

@this is an array not a string... make up your mind...

>$that = [TheValueThatINeed];
>$foo = grep(/$that/,@this.);

Do you even know what grep does? This does not do what you think it
does in the following lines...

A variable that is constant without /o is a bit innefiecient.

>$bingo=substr($foo,0,10); # gets the first part of you IP string

Except of course that $foo is the number of elements in @this that matched
your test.

Ans also who said the IP is at the start of the string, and we already know
the start of the IP (that you extracted) since that's what we matched on.

>$result=$bingo."[LastThreeNumbers];"

But [LastThreeNumbers] is what was being looked for and thus can't be 
hard coded into the script... 

Now onto the real question since you managed to stuff up the answer...
>AJ

>(BXTC) wrote in message <3681796B.29E6C8BE@forfree.at>...
>>Hi, I am very new to perl and am tring to learn by doing as well as
>>reading.  I am writing a small program annd I need it to be able to get
>>an IP out of a file. example:
>>
>>system "netstat -n >> .netstat";

It may be better to use a construct like :
open(NTST, "netstat -n |");

That way you don't need the temporary file. Of course the file may have been
created some other way, or you may need to have a copy around.

>>
>>so now I need to search for a string in the .netstat file.  I know that
>>the IP will start with 209.195.11.***. so I was thinking somehow I'd
>>search like this:
>>
>>open (NTST, ".netstat");
>> now how do I look inside the file now that it is open?
>>I need to search for something like  /209\.195\.11\..../ but have it
>>fill in the last 3 ...'s with the real numbers and then save it to a
>>string.

The regular expression /209\.195\.11\.\d{1,3}/ will match the what I
think you want to match.

So if there is only one possible IP matching per line we can use :
while(<NTST>) {
	if (/209\.195\.11\.(\d{1,3})/) {
		#do what we want with the match.
		print $1;
	}
}

If you can have multiple matches per line then :
while(<NTST>) {
        while (/209\.195\.11\.(\d{1,3})/g) {
                #do what we want with the match.
                print $1,"\n";
        }
}

Of course there are probably much more elegant ways of doing it. But at least
to my small tests this appears to work and give correct output for my (I must
admit small) local netstat (of course I changed the test a little).

How hard can it be to actually run your code through perl... I mean perl has
-x as a command line option and __END__ which make it really easy to
actually just run your post through perl before sending it.

Now that I've said that my post (which I cut and paste as opposed to the
perl -x way since I needed some scaffolding) will obvious be incorrect, but
at least I made an attempt to test it.


-- 
Sam

So I did some research. On the Web, of course. Big mistake...
	--Larry Wall


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

Date: Sun, 27 Dec 1998 22:58:34 -0500
From: "John Zeng" <john_z@hotmail.com>
Subject: Sending mail to multiple addresses
Message-Id: <766vle$2fk$1@birch.prod.itd.earthlink.net>

Is it possible to send mail to multiple emails (that was pulled from a text
file) in PERL 5 or is there a certain process?

 ...textfile below...

email@isp.com
email@isp.net
email2@isp.edu

 ...end textfile...

or to send straight like this>>>...
email@isp.com; email@isp.net; email2@isp.edu;





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

Date: 28 Dec 1998 04:36:03 GMT
From: groovy94@aol.com (Groovy94)
Subject: Re: Sending mail to multiple addresses
Message-Id: <19981227233603.00798.00002705@ng-fv1.aol.com>

ok, let's pretend the text file's name was emails.txt

open (EMAILS,"<emails.txt");
@emails=<EMAILS>;
close (EMAILS);

foreach $email (@emails) {
open (MAIL,"$mailprog");
print MAIL "To: $email";
print MAIL "From: You@yourhost.com";
print MAIL "Subject: Stuff";
print MAIL "Hey!";
close (MAIL);

that quite simply does it


Regards,
Gil Hildebrand, Jr.
Dynamic Scripts

Email: groovy94@aol.com
ICQ UIN: 16678754


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

Date: Mon, 28 Dec 1998 03:06:58 -0700
From: "Brandon Burt" <bb@jesusfish.xmission.com>
Subject: Syntactical weirdness? Or is it just me?
Message-Id: <767ln4$fpt$1@news.xmission.com>

I'm trying to find the deep, inner meaning in this weirdness. This snippet:

$string='sdrawkcab';
print reverse($string);
$bstring=reverse($string);
print $bstring;

produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
which seems to be the intuitive thing. While I know I shouldn't expect Perl
to always do the intuitive thing, it makes me wonder if I'm missing a subtle
point which might bear on other Perl-related issues.

-Brandon Burt





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

Date: 28 Dec 1998 10:28:50 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <slrn78enb1.7j7.sholden@pgrad.cs.usyd.edu.au>

On Mon, 28 Dec 1998 03:06:58 -0700, Brandon Burt <bb@jesusfish.xmission.com>
	wrote:
>I'm trying to find the deep, inner meaning in this weirdness. This snippet:
>
>$string='sdrawkcab';
>print reverse($string);
>$bstring=reverse($string);
>print $bstring;
>
>produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
>which seems to be the intuitive thing. While I know I shouldn't expect Perl
>to always do the intuitive thing, it makes me wonder if I'm missing a subtle
>point which might bear on other Perl-related issues.

print gets a list as it's argument... Thus the first reverse is in a list
context. And from perlop :

reverse LIST

In list context, returns a list value consisting of the elements
of LIST in the opposite order.  In scalar context, concatenates the
elements of LIST, and returns a string value with all the characters
in the opposite order.
 
Thus you reversed the list ('sdrawkcab') to the list ('sdrawkcab'). Since it
has one element reversing it doesn't change it a lot...

print scalar reverse($string);

might be what you want.

-- 
Sam

comments on data are usually much more helpful than on algorithms
	--Rob Pike


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

Date: 28 Dec 1998 10:33:47 GMT
From: meowing@banet.net (Fluffy)
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <767mq6$ju@meow.invalid>

Brandon Burt <bb@jesusfish.xmission.com> wrote:
> I'm trying to find the deep, inner meaning in this weirdness. This snippet:
> 
> $string='sdrawkcab';
> print reverse($string);
> $bstring=reverse($string);
> print $bstring;
> 
> produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
> which seems to be the intuitive thing. While I know I shouldn't expect Perl
> to always do the intuitive thing, it makes me wonder if I'm missing a subtle
> point which might bear on other Perl-related issues.

What you're missing is that print interpreted the result of reverse()
as a list rather than a scalar.  Print thinks that everything is a list
unless you tell it otherwise. Since your list had only one element,
reverse() didn't do anything.

This is what you wanted:

	print scalar(reverse($string));


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

Date: Mon, 28 Dec 1998 10:40:21 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Syntactical weirdness? Or is it just me?
Message-Id: <ebohlmanF4o8B9.3A9@netcom.com>

Brandon Burt <bb@jesusfish.xmission.com> wrote:
: I'm trying to find the deep, inner meaning in this weirdness. This snippet:

: $string='sdrawkcab';
: print reverse($string);
: $bstring=reverse($string);
: print $bstring;

: produces the string: "sdrawkcabbackwards", and not "backwardsbackwards"
: which seems to be the intuitive thing. While I know I shouldn't expect Perl
: to always do the intuitive thing, it makes me wonder if I'm missing a subtle
: point which might bear on other Perl-related issues.

Yep, you're missing the distinction between scalar context and list
context.  The arguments to print are evaluated in list context, so
reverse() takes a one-element list, consisting of a single string, and
reverses the elements in the list, which unsurprisingly results in the
same thing.  When you assign the result of reverse() to a scalar, reverse()
takes a single scalar argument and reverses it character-by-character. 

If you changed your second line to 'print scalar reverse($string)' you 
would get what you were expecting.



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

Date: 28 Dec 1998 04:12:00 GMT
From: greggsilk@aol.com (Gregg Silk)
Subject: Usual "Hello, world" problem
Message-Id: <19981227231200.12881.00002265@ng-fd1.aol.com>

hey there,

OK I have been reading the FAQs and bought the gecko book, installed Perl5 on
Win95, typed hello.plx as a text file and saved it in the same dir as perl,
started the DOS window from Windows Explorer, type >perl hello.plx and get the
message:

Can't open Perl script "hello.plx": no such file or directory.

If I just type >perl, the title bar of the DOS window does say Perl, so it
seems to be working.

Gregg


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

Date: Mon, 28 Dec 1998 05:09:51 GMT
From: mschechter@earthlink.net (Mike Schechter)
Subject: Re: Usual "Hello, world" problem
Message-Id: <368711a6.24993408@news.earthlink.net>

On 28 Dec 1998 04:12:00 GMT, greggsilk@aol.com (Gregg Silk) wrote:

>hey there,
>
>OK I have been reading the FAQs and bought the gecko book, installed Perl5 on
>Win95, typed hello.plx as a text file and saved it in the same dir as perl,
>started the DOS window from Windows Explorer, type >perl hello.plx and get the
>message:
>
>Can't open Perl script "hello.plx": no such file or directory.
>
>If I just type >perl, the title bar of the DOS window does say Perl, so it
>seems to be working.

Gregg,

Perl is most likely in your path.  When you opened the DOS window, did
you change to the directory containing the file hello.plx?  Just
because the file is saved in a directory that is in your path doesn't
mean perl will look for it.  It looks in the directory that you are
in, unless you supply it a different directory to look in.  I tried
moving a script that I have into my perl/bin directory in NT, and went
to the C:\ prompt and typed in perl with the name of the file, and
received the same error as you.

Mike



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

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

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