[6942] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 567 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 4 06:07:51 1997

Date: Wed, 4 Jun 97 03:00:24 -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           Wed, 4 Jun 1997     Volume: 8 Number: 567

Today's topics:
     Re: *NOT SPAM* Apprentice Perl Hacker, Summer Work Offe (B. Mathis)
     Re: Array of hashes with use strict; <rootbeer@teleport.com>
     Re: Collect all Function Names in a C file (Chipmunk)
     Re: Decoding of the 'Zafir' language :) (Nathan V. Patwardhan)
     Re: Decoding of the 'Zafir' language :) <matkin@zeke.update.uu.se>
     Re: fetching a html page from a www server <rootbeer@teleport.com>
     find out no.of lines in open file (Pui Ming WONG)
     Re: getting next line in while (Mont Erickson)
     Re: Good Perl Tutorial with exercises ?? (Dave Cross)
     Re: How can I set up this server to run perl faster?... <perlprogrammer@hotmaill.com>
     Re: inconsistent opendir behaviour in Perl for win32 <s.oosthoek@student.utwente.nl>
     Re: Introductory Comparison of Perl and Python (Dominic Dunlop)
     Re: LOG base 10  operator (Chipmunk)
     malformed header from script ??? <yzhou@mtu.edu>
     Re: Mass emailing <andrew@squiz.co.nz>
     mount command in an suid script - howto ? (Helmut Jarausch)
     newbie question <steven.depuydt@wkb.be>
     Re: Newbie question <ajohnson@gpu.srv.ualberta.ca>
     Re: odd problem with readdir <rootbeer@teleport.com>
     Re: performance question for sorting text from a large  (Chipmunk)
     Re: printf padding ... (Christopher Greenup)
     Re: printing a hash in order? (Chipmunk)
     Re: Question: Simple Giving and Getting info to WWW <rootbeer@teleport.com>
     Re: Submit form via script? (Rachel Polanskis)
     Re: why won't 'print <<end_print...end_print' work? <perlprogrammer@hotmaill.com>
     Re: why won't 'print <<end_print...end_print' work? <jbokma@caiw.nl>
     Re: why won't 'print <<end_print...end_print' work? <perlprogrammer@hotmaill.com>
     Re: why won't 'print <<end_print...end_print' work? (I R A Aggie)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 4 Jun 1997 04:26:49 GMT
From: bcmdco@osfmail.isc.rit.edu (B. Mathis)
Subject: Re: *NOT SPAM* Apprentice Perl Hacker, Summer Work Offered
Message-Id: <5n2qq9$jqp$1@news.isc.rit.edu>

In article <3394b30d.12764996@news.ntr.net>, Mark Mills <mark@ntr.net> wrote:
>On Thu, 29 May 1997 19:26:30 -0400, "Robert S. Kissel"
><kissel@kissel.spicerack.ibm.com> wrote:
>>I have suitable work for an apprentice Perl hacker (college student,
>>or even high-school, if you're real good).  The location is Westchester
>>County, just north of the Tappan Zee bridge.
>
>*NOT SPAM* Apprentice Perl Hacker, Summer Work Offered
>Finally my friend in New Jersey reported back that it was in New York
>State.
>You just announced, to the _WHOLE WORLD_, that you have _ONE_ job
>available north of a locally famous tourist attraction...
>
>*IS SPAM*

You, sir or madam, are a moron.  First, if we start by defining "spam"
in internet terms, we find a definition of "mass distribution of a
message that is unrelated to the groups they are posted in".  This
message is quite clearly about a perl related topic, that was posted
in a group about perl.

And, as the net is new to alot of people, they sometimes forget that
messages go to the whole world, and forget to put in a location.

However, as would be the case with many students at this time of year,
the school year is over and many might be returning to the New York
City area.  This would be a good way to inform such individuals who
are not at home, but are soon to be, that there is a possible job for
them.

Ok, im finished wasting your time now.

Brian



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

Date: Tue, 3 Jun 1997 20:30:20 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: Joonas Timo Taavetti Kekoni <jkekoni@cc.hut.fi>
Subject: Re: Array of hashes with use strict;
Message-Id: <Pine.GSO.3.96.970603202623.21398E-100000@kelly.teleport.com>

On 3 Jun 1997, Joonas Timo Taavetti Kekoni wrote:

> i have $code[}{} structure. How can i define it using my with
> use strict; ?

Maybe you mean $code[]{} ?  But you can define that by using a 'my'
variable under 'use strict'. 

> With commonn sense  my( %@code  ); would sound logical, but wont work.

No, that's not going to work. 'my' variables can be only plain scalars,
hashes, or arrays. Here's what you want. 

    use strict;
    my(@code);				# The base array
    $code[2]{fred} = "flintstone";	# Using a nested element

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: 4 Jun 1997 05:33:23 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: Collect all Function Names in a C file
Message-Id: <5n2un3$m14$1@dartvax.dartmouth.edu>

In article
<Pine.SV4.3.95.970602211452.17977B-100000@vu-vlsi.ee.vill.edu>
Senthilvel Rangaswamy <senthil@ece.vill.edu> writes:

> I am looking for a perl script which will read in a standard C file and 
> output all the function names used in that C file. Does anybody have
> any ideas or pointers...

This should output all the functions defined in the file.  Is that what
you're looking for?
It seems to work okay on the files I tested it on.  (Although I
wouldn't be surprised if that regexp doesn't work in all cases.)

#!/usr/local/bin/perl

if (!defined $ARGV[0]) {
  die "Usage: $0 filename\n";
}

$codefile = shift @ARGV;

undef $/;

open(CODE, $codefile) || die "Unable to open $codefile: $!";

$code = <CODE>;

while ($code =~
       m!
          ^\s*                  # optional white space
          (?:[a-zA-Z]\w*\s+)*   # zero or more special types (static et
al.)
          [a-zA-Z]\w*\s*        # the actual return type
          [\s\*]\s*             # could return a pointer
          ([a-zA-Z]\w*)         # the function name
          \([^\)]*\)            # the parameter list
          \s*\{                 # optional white space and the open
brace
          !mgx                  # multiline, global, with comments
          ) {

  print "Function: $1\n";
}

Chipmunk


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

Date: 4 Jun 1997 02:43:55 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Decoding of the 'Zafir' language :)
Message-Id: <5n2kpb$80q@fridge-nf0.shore.net>

Abigail (abigail@fnx.com) wrote:

: ++   "Rifaz Evil Gnol!" =  "Long Live Zafir!"

Long live Zamfir ... "master of the pan flute," "orator of the
elevator," "chariots of fire," and "love on the rocks" 

???
--
Nathan V. Patwardhan
nvp@shore.net



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

Date: 04 Jun 1997 09:54:23 +0200
From: Matz Kindahl <matkin@zeke.update.uu.se>
Subject: Re: Decoding of the 'Zafir' language :)
Message-Id: <yf5raei6bwv.fsf@Zeke.Update.UU.SE>

Andrew Johnson <ajohnson@gpu.srv.ualberta.ca> writes:

> 
> [snip]
>  
> !   As you can see, the language is a very simple one. This is
> ! his suggestion for an algorithm, using the test-string
> ! 
> !   "Rolling On the Floor Laughing And Scaring The Cat"

[snip] 

> !   Comments ? As there is More Than One Way, I'd love to see
> ! some suggestions for other implementations... >:) Any
> ! RegExperts willing to attempt a oneliner ?
> 
> $_ = "Gnillor No eht Roolf Gnihgual Dna Gniracs Eht Tac" ;
> s#(\w+)#print ucfirst(join "",reverse split //,lc $1)." "#eg;
> 
> dealing with punctuation within a sentence is left as
> an excersise for the reader :-)

Neat, very neat indeed. :)

My first thought was something along the following line.

perl -pe 's#\w+#ucfirst lc(join"",reverse split//,$&)#eg'

It deals with punctations as well.

It doesn't deal with Latin-1 though. :/

"People do strange things when you give them money."
        -- Simple Minds


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

Date: Tue, 3 Jun 1997 20:41:43 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "J. Linder" <jann@jann.com>
Subject: Re: fetching a html page from a www server
Message-Id: <Pine.GSO.3.96.970603203757.21398H-100000@kelly.teleport.com>

On 3 Jun 1997, J. Linder wrote:

Newsgroups: comp.lang.perl

If your news administrator still carries comp.lang.perl, please encourage
him or her to check out the frequent posting about bogus newsgroup names
in news.announce.newgroups. You'll be doing yourself and many others a
favor to use comp.lang.perl.misc (and other valid Perl newsgroups)
instead.

    news:news.announce.newgroups

> I need to know how I go about taking a http:// address & fetching it from
> a web server.

Did you check the FAQ? :-)  This article tells about using LWP, which can
do all you need. Hope this helps!

    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq9/
          How_do_I_fetch_an_HTML_file_.html

-- 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: 4 Jun 1997 09:22:48 GMT
From: s11976@net2.hkbu.edu.hk (Pui Ming WONG)
Subject: find out no.of lines in open file
Message-Id: <5n3c58$c2g$1@power42t.hkbu.edu.hk>

I have a trivial question as i just get started on perl
In my program i have opened a file,i.e.
open(COUNT,"$myfilename")

Now i would like to know the total no. of lines in this file COUNT,
what statements are available, perl's own or could i call the
unix command
 wc -l $COUNT ?
--
        __
   / \_/  )             __   Pui Ming WONG (E-mail: pm@hkbu.edu.hk) 
  /      ( -------------  }  System Support Programmer
 (  =l=ll===============__}  Computing & Telecomm. Services Centre
  \   _  (                   Hong Kong Baptist University 
   \_/ \__)                  224 Warerloo Road, Hong Kong 


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

Date: Wed, 04 Jun 1997 07:21:22 GMT
From: merick@xmission.com (Mont Erickson)
Subject: Re: getting next line in while
Message-Id: <5n31e7$9sg$1@news.xmission.com>

etfinley@ece.ucdavis.edu (Eric Finley) wrote:

>How can I get the next line of the file while in the while loop without going through the
>next iteration of the while.  My code looks like:

Try this...

while (<FILE>) {
    if (/foo/) {
	print;
    }
    if (/bar/) {
	print;
        $newline = <FILE>;
	print $newline;
    }
}





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

Date: Tue, 3 Jun 1997 12:38:07 GMT
From: crossd@gb.swissbank.com (Dave Cross)
Subject: Re: Good Perl Tutorial with exercises ??
Message-Id: <CROSSD.97Jun3133807@ln4d110swk.gb.swissbank.com>

In article <338F1BE5.31DF@austx.tandem.com> Jim Garrison <jhg@austx.tandem.com> writes:
 
> Has anyone written a good Perl tutorial that has
> well-written, meaningful exercises?  

Jim,

Randal Schwarz has. It's called 'Learning Perl', it's published by
O'Reilly and is available at all good bookstores. You might want to hold
off buying it as there's a new edition due out real soon now (does anyone
have any dates on this?)

Dave...
-- 
Opinions are mine, not the company's - hell I don't think the
company even knows who I am.

Dave.Cross@gb.swissbank.com


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

Date: Tue, 03 Jun 1997 21:36:06 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: Re: How can I set up this server to run perl faster?...
Message-Id: <3394F0B6.461C@hotmaill.com>

Michael Parson wrote:
> 
> In article <3392669D.73BE@hotmaill.com>,
> perl guy  <perlprogrammer@hotmaill.com> wrote:
> >Huge aplogies for the major cross-postings.. but I have NO idea where to
> >post to, other then the fact that it has to do wth all the formentioned
> >subjects.
> >
> >Ok, first off, I am running perl 5.003 on a Linux Kernel 2.0.18 on an
> >i486 server with Red Hat 4, Apache 1.1.1, 5 disk partiions of 300 Megs
> >each, 48 MEGS RAM with a 60 MEG swap file..
> 
> Eep, this sounds like weird partitioning scheme... you definately need
> more swap. :/
> 
> These are the basic outlines for partitioning that I follow:
> 
> /       32-64 megs, depending on OS version.  Keep it small and as static
>         as possible.  You need this partition to be able to survive a
>         worse-case crash, the less of this partition that is changed
>         and only exists in RAM, the better.
> 
> <swap>  I make this 2x RAM, a good rule-of-thumb if you are running
>         < 512meg of real RAM.  If you are running with more RAM, use
>         your best judgement, experience will help a lot in this senario.
> 
> /var    I generally make this 64 megs as all that goes here is logs.
>         Rotate your logs.  If you need to keep a larger back-log, make
>         this partition larger.
> 
> /home   This depends on how many users you have, and how much you plan on
>         doing in your home dirs.  I generally put home-dirs under /usr/home
> 
> /usr    The rest of your disk, or another drive entirely...  This is the
>         most volitile partition you've got.
> 
> if you are using solaris, you will also need
> 
> /opt    This partition is where you put prepackaged software.  Depending
>         on the mood I'm in, this will either be a symlink to something under
>         /usr, or a seperate partition whose size will be dictated by the
>         role this particular system will be serving.
> 
> >I am running a chat site that is getting a huge amount of traffic, and I
> >need to find out a way, to only run one continous instance of perl, or
> >something that won't chew up the drive or slow things down so terribly!
> >It's literally killing the hard drive from all the people. I need to
> >find out a way to configure something too possibly for the best way to
> >run the server for this sort of thing. I wish it was on the NT bo,
> >because I could do an ISAPI type thing.. but what can I do on a Linux
> >with Perl?. I seriously have no idea. every time someone transfers the
> 
> A few things you might want to look at.
> 
> First is, update your version of Apache to the latest/greatest 1.2.
> 
> Next, get mod_perl, you can find it at your favorite CPAN archive.
> 
> Another thing you can look at is fast-cgi (www.fastcgi.com).  FCGI
> requires that you have perl compiled against sfio, which you can
> grab from http://www.research.att.com/sw/tools/sfio/.  If you need
> help compiling this, drop me a line, I can offer *some* assistance.
> 
> --
> Michael Parson
> Mail sent to this posting host will not make it to me, to reply,
> send to just the domain.

Wow.. thanks for all the help!.. that's great of you. I've been looking
into perl_mod the last few days, and I've been trying to talk my server
admin into upgrading anyway..  I've looked at fastcgi and found it very
interesting. I thank you for all the help. I'll let you know if I can
use "some" help. :)  I know people don't like compiling for others.. he
he he.. :)  Really.. thanks again..


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

Date: Wed, 04 Jun 1997 10:49:26 +0200
From: Simon Oosthoek <s.oosthoek@student.utwente.nl>
Subject: Re: inconsistent opendir behaviour in Perl for win32
Message-Id: <33952C16.42A7BA2@student.utwente.nl>

Nathan V. Patwardhan wrote:
> 
> Simon Oosthoek (simon@shadow.student.utwente.nl) wrote:
> 
> : : What version of NT Perl are you using?
> 
> : build 304.
> 
> : is it fixed in a newer version?
> 
> I dunno.  For my "weekly M'soft hour featuring NT Perl" I've been
> using build 303 without a hitch, including opening directories like:
> 
> $dir = 'd:/';
> 
> which you *might* have to represent like:
> 
> $dir = 'D:/';
> 
> but I might be blowing smoke.  :-)

This is with opendir?

The uppercase and  the "/" for the "\"  make no difference...
This problem is so illogical, it looks more and more like a bug to me.

I'll have to try build 306 to see if that helps, but I haven't had time
for that yet....

Simon.


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

Date: Wed, 4 Jun 1997 11:26:07 +0200
From: domo@tcp.ip.lu (Dominic Dunlop)
Subject: Re: Introductory Comparison of Perl and Python
Message-Id: <19970604112607501983@dialup20.ip.lu>

Tom Christiansen <tchrist@mox.perl.com> wrote:

> In comp.lang.python, 
>     tjreedy@udel.edu (Terry Reedy) writes:
> :This article compares basic features of Perl (4.x) and Python (1.4) by means
> :of side-by-side code examples followed by minimal commentary.  
> 
> That's not very useful -- v4 Perl is six or seven years out of date.
> You need to think about v5.

Well, as far as it goes, the comparison's valid.  That's to say, the
features compared are all in perl4, are still in perl5, and, by and
large, are still considered the 'natural' way to do things in perl5.
(Or natural to those who don't try to program in one-liners, anyway.)
The Perl side of a fuller comparison would be based on edition 2 of the
camel book, rather than on the llama book.  But I think an adequate way
of meeting Tom's criticism is quickly to check the tables against the
camel book, discover that little needs changing, and then revise the
article prologue to say

This article compares basic features of Perl (5.004) and Python (1.4)...

A few remarks to that end and typo corrections.  (Remarks are not
perl5-specific unless they say so explicitly.):

> PYTHON                                        PERL

> FILE.write("Hello, world\n)           print FILE "Hello, world\n";

In perl5, you can also (after some set-up) say  $handle->print("Hello,
world\n"); if you want to.

> name = stdin.readline()[:-1]          $name = <STDIN>; chop($name);

Those of a one-line tendency would say  chop($name = <STDIN>)

> # To avoid name collisions, both provide multiple name spaces
> - multiple modules and classes                - flags for types of variables
>                                       $name is a scaler (number/string)
                                                       ^
That's 'scalar'.  Perl5 scalars can also hold references.  References
are a key part of perl5's object-oriented features (although they can
also be used without all that OO stuff, should the programmer so wish).

>                                       - Perl 5 packages?

Yes.  Packages are also a key part of perl5's OO features.  However, use
of packages simply to avoid namespace collisions, as in perl4, is still
perfectly acceptable.

> print 'Hello, '+name+'\n',            print 'Hello, '.$name.'\n;

That should probably be  print 'Hello, ' . $name . "\n";

> COMPARISON, IF/THEN                   COMPARISON, IF/THEN
> if name == 'Randal':                  if ($name eq 'Randal) {

That should be  if ($name eq 'Randal') {

> blocks delimeted by required indent   blocks delimeted by {}
              ^                                     ^
'delimited'

> TUPLES/LISTS, NUMBERS                 ARRAYS, NUMBERS
> words = ('camel','llama','oyster')    @words= ('camel','llama','oyster');

You can also say  @words = qw(camel llama oyster);  in perl5

> i=0; correct='?' # 0-based index      $i = 0; $correct = '?'; # ditto
> while correct == '?':                 while ($correct eq '?') {
>   if guess == words[i]:                         if ($guess eq $words[i])
>     correct = 'y'                          {$correct = 'y';}
>   elif i < 2: i = i+1                   elsif ($i < 2) {$i = $i+1;}
>   else: break                           else {last;}
>                                       }

Perl's for(;;) is made for this sort of thing:

for ($i = 0, $correct = '?'; $i <= $#words; $i++) {
  $correct = 'y', last if $guess eq $words[$i];
}

Here, $#words is index of the last element of @words, and ++ is the
(post-)increment operator.  Being of a one-line-ish tendency, I also
threw in comma operators and an 'if' qualifier.  But anyway, in any
language offering dictionaries/hashes, it's more natural and quicker to
use them, rather than arrays, for this sort of thing.  Sorry, I don't do
Python, but it looks like this in perl5:

%words = (camel=>1, llama=>1, oyster=>1);  # Bare words OK: saves quotes
$correct = ($words{$guess}) ? 'y' : '?';

('=>' is just a synonym for ','; the second line behaves just as it
would in C ... if C had hashes.)

> Numbers are int (C long), long                Numbers are internally C doubles

If numbers can be exactly represented by a machine integer, then that's
how they're stored, otherwise they're doubles.

> complex (pair of floats)              ++$i; or $i++; as in C syntax.

Perl5 supports complex numbers through an add-on module which overloads
many operators and functions.  There are similar (although currently
less comprehensive) facilities for arbitrary-precision integer and real
number arithmetic.

> DICTIONARIES                          ASSOCIATIVE ARRAYS

"Associative array" now tends to be spelled "hash" in the Perl lexicon.

> name = lower(name) # or, more general $name =~ tr/A-Z/a-z/; # lowercase it
> name = translate(name,maketrans(uppercase,lowercase))

In perl5, you can also say  $name = lc($name);  or, more trickily,
$name = "\L$name"  (or, since it's Perl, and there's more than one way
to do it, many other idioms, some of which respect the current locale,
and some of which do not).

> FUNCTIONS                             FUNCTION/SUBROUTINES
> def lowerfirst(word):                 sub lowerfirst {

FWIW, perl5 has a built-in, lcfirst(), to do this.

> return None or explicit expression    return last expression evaluated

Perl, with  return, can return an explicit value.  There's no way to
return nothing, although, in perl5.004, functions can enquire whether
their caller is interested in getting a return value (that is, if the
return value is going to be used), and not waste time calculating
something meaningful if it's not.
-- 
Dominic Dunlop


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

Date: 4 Jun 1997 05:59:23 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: LOG base 10  operator
Message-Id: <5n307r$n5p$3@dartvax.dartmouth.edu>

In article <tcyangEB6LI1.7Cp@netcom.com>
tcyang@netcom.com (Tung-chiang Yang) writes:

> I am a newbie .....  but I wonder why we need to use "$_[0]"......

$_[0] is the first element of the array @_.  Remember that arguments to
a subroutine are passed in via @_.  Thus $_[0] is the first argument to
the subroutine.

Chipmunk

> =======================
> Tom Phoenix (rootbeer@teleport.com) wrote:
> : On 2 Jun 1997, Michael J. Rocchetti wrote:
> 
> : > Does anyone know how to take the log base 10 of a number using PERL?
> : sub log10 ($) { log($_[0])/log(10) }


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

Date: Tue, 03 Jun 1997 23:53:46 -0400
From: Yan Zhou <yzhou@mtu.edu>
Subject: malformed header from script ???
Message-Id: <3394E6CA.41C67EA6@mtu.edu>

hello, everyone

    I have written a perl program, which requires cgi-lib.pl, a perl
routine.

    But after I put "print &PrintHeader" at my perl code. I still have
to put it into cgi-lib.pl, too. Otherwise I was notified as "500 Server
Error: malformed header from script".

    Say, in my program, 

    #!/usr/local/bin/perl

    require "cgi-lib.pl";

    print &PrintHeader;

     ...


    I have to add one line into cgi-lib.pl as follows:

    print &PrintHeader;



    As we all know, this is not needed. But I have no idea about it.

    Any hint will be greatly appreciated.

						Yan Zhou
						yzhou@mtu.edu


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

Date: Wed, 04 Jun 1997 20:29:21 +1200
From: "Andrew McNaughton" <andrew@squiz.co.nz>
Subject: Re: Mass emailing
Message-Id: <andrew-0406972029210001@banjo.actrix.gen.nz>

In article <338DAB58.41C67EA6@wwisp.com>, Steve Buchanan <steveb@wwisp.com>
wrote:

>Lauri Laakso wrote:
>> 
>> I am working with mass mailing system (not spam, user have to register
>> first), and I need to know what is best way to send same email to
>> all of @emails ?
>
>Here is a piece of code I use all the time for exactly that.  List all
>of your email addresses in a file, one per line.  Then run the
>following:
>
>#!/usr/bin/perl
>
>$count = 0;
>open (in, '/path/to/address/list.txt');
>while(<in>){
>        foreach $_ (split (/[ \t\n]+/))
>        {$name = $_;}
>$count ++;
>if ($count == 20)
>{
>$count = 0;
>sleep 2;
>}
>
>#system ("mail $name  < /path/to/file/you/you/want/to/send");
>
>}
>close in;

If I've correctly understood something I just read, there are legitimate
(group) email addresses which contain semicolons.

eg 
Reply-to: group:<andrew@squiz.co.nz>;

This would break your code. 

Depending on how your email list is generated, it could be a security issue.


I wonder what would happen if I started putting posts all over usenet with
semi-colon delimited command line arguments in my Reply-to address.

This is more than a casual interest - I know how to avoid using shell calls,
but I want a way to verify email address formats for a list of users so that
I can be sure a bad format on one address won't screw up delivery to other
addresses on the list. 



Andrew McNaughton


Check out the newsroom: http://www.newsroom.co.nz
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
 
      S                       GRAPHICS
       Q                     HTML
        U                   CGI            Andrew McNaughton
         i                JAVA            Andrew@SQUiZ.co.nz
          Z              VRML         http://www.squiz.co.nz

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



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

Date: 4 Jun 1997 08:12:00 GMT
From: jarausch@numa1.igpm.rwth-aachen.de (Helmut Jarausch)
Subject: mount command in an suid script - howto ?
Message-Id: <5n380g$n0l$1@news.rwth-aachen.de>

Hi,
I tried to use
system('/bin/mount ...');
in a script that has been set root+suid (yes, I have suidperl)

Still, I get the (system) error message
mount: only root can do that.

Probably the read UID is not root when  mount is invoked.
What did I miss?
(setting mount itself to root/suid is not a solution, since I only want users
 to mount floppies)

Thanks for any hints

-- 
Helmut Jarausch
Lehrstuhl f. Numerische Mathematik
Institute of Technology
RWTH Aachen
D 52056 Aachen, Germany


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

Date: Wed, 04 Jun 1997 09:48:18 -0700
From: steven depuydt <steven.depuydt@wkb.be>
Subject: newbie question
Message-Id: <33959C52.66E6@wkb.be>

Is there an easy way to open a text file, make changes to it and close
the file?
Is this a right way to do the job?


open (FILE1,"c:/files/file1.txt");
	while (<FILE1>) {
	  s/something/something else/g;
	  push (@mylist,$_);
        }
print "@mylist";


Is there a way to avoid the push rule?

Thanks for any suggestion,

</Steven>


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

Date: Tue, 03 Jun 1997 21:06:20 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Newbie question
Message-Id: <3394CD9C.3ACB27EB@gpu.srv.ualberta.ca>

! Bill Thompson wrote:
! >
! > To get the number of characters in a string, I'm 
! > using the following:
! >
! > sub ChkQID {
! >     my ($QID) = @_;
! >     my ($nchars, $i);
! >
! >     $_ = $QID;
! >     $nchars = tr/\000-~//;  # get the number of characters
! >
! > Is there a better way?
! 
! How about:
! 
! $nchars = scalar(split(//, $_));
! 
! ;-)
! 
! Chipmunk

hmm
or even:

$nchars=pos if /$/g;
   or
$nchars=s/(.)/$1/g;

or perhaps an ugly regex approximation of a map{} in
void context:

s/(.)/!$`?$nchars=1:$nchars++;$1/eg;

:-0

(it would be nicer? if we could assume $nchars
was zero to start with: s/(.)/$nchars++;$1/eg; and
even a bit funky with a better choice of delimiter
   s+(.)+$nchars\+\+;$1+eg;

;)
andrew


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

Date: Tue, 3 Jun 1997 20:36:34 -0700
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: odd problem with readdir
Message-Id: <Pine.GSO.3.96.970603203409.21398G-100000@kelly.teleport.com>

On Tue, 3 Jun 1997, chris wrote:

> @target_contents = readdir(TARGET) || die "couldn't read directory: $!";

The or operator ('||') is forcing a scalar context upon readdir, which
will thus return just one item at a time. You probably wanted this.

    @target_contents = readdir(TARGET) or
	die "couldn't read directory: $!";

Hope this helps!

> If you want to send me email, remove the spam fileter...

I don't want to send you mail that badly. 

-- 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: 4 Jun 1997 05:34:51 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: performance question for sorting text from a large file
Message-Id: <5n2upr$n5p$1@dartvax.dartmouth.edu>

In article <ak10n5.3ph.ln@localhost>
tadmc@flash.net (Tad McClellan) writes:

> Shane 'Fishman' Sherman (fishman@vvm.com) wrote:
> : I was wondering if performance becomes a serious factor when reading
> : and sorting a large file of words. 
> 
> It most definitely is a factor with large files.
> 
> : like maybe 1000 words or less. 
> 
> But I wouldn't call that large (but I wouldn't call 10,000 large either.
> Probably wouldn't even honor 100,000 with "large"  ;-).

Doesn't that depend on the size of the words?

Chipmunk


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

Date: 4 Jun 97 02:28:16 
From: christopher.greenup@nashville.com (Christopher Greenup)
Subject: Re: printf padding ...
Message-Id: <000035250000342B@nashville.com>

No kidding?  I never thought of that ;)

There are several places where the format specifications for printf are 
detailed, including the sprintf section of the Camel Book, the printf man 
page, several C books, and some other Perl books, etc.  However, format 
specifications are not what I'm looking for.

All these resources say that strings will be padded with spaces unless the 
format specifier '0' is given, in which case they will be padded with '0's.
They do not say, however, if it is possible to pad with something else, and 
if it is, how to do so.

So, my question stands (as above).

PoundBangSlashYou,

Christopher Greenup

chrisg@gibson.gibson.com
Gibson Guitar Corporation
www.gibson.com



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

Date: 4 Jun 1997 05:57:10 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: printing a hash in order?
Message-Id: <5n303m$n5p$2@dartvax.dartmouth.edu>

In article <atstarr-0306970439240001@max01-03.qni.com>
atstarr@negia.net (Andrew Starr) writes:

> Thus what I did was to create an array of the variable names, by adding 2
> lines to the split pair process (1 to add the element to the array, one to
> increase the counter variable by one).

How are you adding the element to the array?
If you use push(ARRAY, LIST), you don't need to use a counter variable.

Chipmunk


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

Date: Tue, 3 Jun 1997 20:33:17 -0700
From: Tom Phoenix <rootbeer@teleport.com>
To: "Benjamin M. Hill" <Benjamin.M.Hill@claus.dartmouth.edu>
Subject: Re: Question: Simple Giving and Getting info to WWW
Message-Id: <Pine.GSO.3.96.970603203051.21398F-100000@kelly.teleport.com>

On 3 Jun 1997, Benjamin M. Hill wrote:

> What I need to find is a perl scrip that can post a generated form
> responce to a web page, and another script that can retrieve a web page. 

Did you check the FAQ? :-)  This article tells about using LWP, which can
do all you need. Hope this helps!

    http://www.perl.com/CPAN/doc/FAQs/FAQ/html/perlfaq9/
          How_do_I_fetch_an_HTML_file_.html

-- 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: 3 Jun 1997 11:31:49 GMT
From: rachel@virago.org.au (Rachel Polanskis)
Subject: Re: Submit form via script?
Message-Id: <5n0vb5$d3l@janis.virago.org.au>

As an added bonus, Lincoln Stein's CGi.pm ver. 2.36 actually 
came as part of perl 5.004 ;)

Well done!

rachel


                 defghijklmnopqrstuvwxyz:  What? No ABC?
--
Rachel Polanskis                 Kingswood, Greater Western Sydney, Australia 
grove@zeta.org.au                http://www.zeta.org.au/~grove/grove.html
r.polanskis@nepean.uws.edu.au    http://www.nepean.uws.edu.au/ccd/
                Witty comment revoked due to funding cuts


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

Date: Tue, 03 Jun 1997 21:26:32 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <3394EE78.1A89@hotmaill.com>

Will Sexton wrote:
> 
> If I do the following:
> 
>         print <<"end_print";
>         some text
>         some text on the next line
>         end_print
> 
> my (multiple) sources tell me the program should print the text, without
> having to set the print command for each new line (said sources lacking
> further explanation).  But when I try it, I get an error message ("Can't
> find string terminator "end_print" anywhere before EOF at <progname>
> line <line number>.")  And can't find feature documented among usual
> suspects (camel, llama, etc.).
> 
> Why won't it work?
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Will Sexton                     wise2@mindspring.com
> UNC-CH/Info Sci                 sextw@ils.unc.edu

Wow, two postings ago.. I just saw the answere.. well, maybe not for
you.. why did you put in the "quotes" after << ??.. Did you check to see
if you have any spaces before the last line end_print?  If so, I just
answered that yestersay.. :)


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

Date: 4 Jun 1997 06:45:14 GMT
From: "John Bokma" <jbokma@caiw.nl>
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <01bc70b3$0f00d160$db0ab2c2@tschai>



Will Sexton <sextw@ils.unc.edu> wrote in article
<5n18ks$7n$1@fddinewz.oit.unc.edu>...
> If I do the following:
> 
> 	print <<"end_print";
> 	some text
> 	some text on the next line
> 	end_print
> 
> my (multiple) sources tell me the program should print the text,
without 
> having to set the print command for each new line (said sources
lacking 
> further explanation).  But when I try it, I get an error message
("Can't 
> find string terminator "end_print" anywhere before EOF at
<progname> 
> line <line number>.")  And can't find feature documented among
usual 
> suspects (camel, llama, etc.).
> 
> Why won't it work?

I had the same problem yesterday 8-) (However I used "MENU2" instead
of "end_print".
After deleting the print << line and the end_print line and
reentering these lines it worked!

I think the editor somehow put a space behind the terminator of some
other hidden thingy.

Regards,

John


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

Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)

http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
more...]

email: jbokma@caiw.nl  phone: +31 10 4291827



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

Date: Wed, 04 Jun 1997 00:29:28 -0700
From: perl guy <perlprogrammer@hotmaill.com>
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <339518F2.291A@hotmaill.com>

John Bokma wrote:
> 
> Will Sexton <sextw@ils.unc.edu> wrote in article
> <5n18ks$7n$1@fddinewz.oit.unc.edu>...
> > If I do the following:
> >
> >       print <<"end_print";
> >       some text
> >       some text on the next line
> >       end_print
> >
> > my (multiple) sources tell me the program should print the text,
> without
> > having to set the print command for each new line (said sources
> lacking
> > further explanation).  But when I try it, I get an error message
> ("Can't
> > find string terminator "end_print" anywhere before EOF at
> <progname>
> > line <line number>.")  And can't find feature documented among
> usual
> > suspects (camel, llama, etc.).
> >
> > Why won't it work?
> 
> I had the same problem yesterday 8-) (However I used "MENU2" instead
> of "end_print".
> After deleting the print << line and the end_print line and
> reentering these lines it worked!
> 
> I think the editor somehow put a space behind the terminator of some
> other hidden thingy.
> 
> Regards,
> 
> John
> 
> --
> ----------------------------------------------------------------------
> 
> Need a Freelance Software Developer (MSc)? (CGI, Perl, Java, C, C++)
> 
> http://www.caiw.nl/~jbokma [Java demo's, Curriculum Vitae and
> more...]
> 
> email: jbokma@caiw.nl  phone: +31 10 4291827

John.. if you see this.. I'm curious to know what editor you used that
may have done this.  I've found that certian online editors will word
wrap (way too soon), or just do something weird.. Just curous to know..
Thanks...


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

Date: Tue, 03 Jun 1997 11:00:26 -0500
From: fl_aggie@hotmail.com (I R A Aggie)
Subject: Re: why won't 'print <<end_print...end_print' work?
Message-Id: <fl_aggie-ya02408000R0306971100260001@news.fsu.edu>

In article <5n18ks$7n$1@fddinewz.oit.unc.edu>, sextw@ils.unc.edu (Will
Sexton) wrote:

+ If I do the following:

+         print <<"end_print";
+         some text
+         some text on the next line
+         end_print

+ Why won't it work?

Because you're saying "         end_print" at the end of the block? Try
this instead:

         print <<"end_print";
         some text
         some text on the next line
end_print

James

-- 
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: 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 567
*************************************

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