[7475] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1101 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 30 00:28:03 1997

Date: Mon, 29 Sep 97 21: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           Mon, 29 Sep 1997     Volume: 8 Number: 1101

Today's topics:
     Autmatically invoking Perl code at script startup time. (Lloyd Zusman)
     Can't display private variable values in debugging (Mehmet M. Kayaalp MD)
     chopping second to last char? <jaudall@students.wisc.edu>
     Re: chopping second to last char? <bcoleman@mindspring.com>
     counting string occurences (Kenneth Blinco)
     Re: counting string occurences (Kenneth Blinco)
     Re: extracting between C comments? <rpsavage@ozemail.com.au>
     HERBAL ALTERNATIVE TO LIPOSUCTION -- NOW IN USA! bf@sparksintl.com
     how?! Re: Statistics for comp.lang.perl.misc <spage@macromedia.com>
     Re: NEEDED:    E-Mail Subroutine (Faust Gertz)
     Re: New Perl syntax idea <chris@ixlabs.com>
     Re: New Perl syntax idea (brian d foy)
     Re: Newbie ques: How to concatenate two strings? (Joseph)
     Re: Newbie ques: How to concatenate two strings? (Joseph)
     Re: Newbie ques: How to concatenate two strings? (Joseph)
     Re: Newbie ques: How to concatenate two strings? <doug@tc.net>
     Re: Newbie ques: How to concatenate two strings? (Martien Verbruggen)
     newbie question : crypt library <deschenj@rc.gc.ca>
     Re: newbie question : crypt library <bholzman@mail.earthlink.net>
     Re: nombre de champs de donnies (A. Deckers)
     Re: Perl socket byte ordering question <bholzman@mail.earthlink.net>
     Re: Perl Venery <ajohnson@gpu.srv.ualberta.ca>
     Re: Perl4 is *not* Y2K (was Re: Y2K) (I R A Aggie)
     References - saving & using (newbie) samdie@ibm.net
     Syntax Question using regular expressions. (Ramon Rodriguez)
     Re: Test for alphabetic character? <gabor@vinyl.quickweb.com>
     Re: Text::English <rpsavage@ozemail.com.au>
     Tutors Needed for Programming Languages Mailing List (Academic Assistance Access)
     Re: write to variables <zenin@best.com>
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 29 Sep 1997 23:13:11 GMT
From: ljz@asfast.com (Lloyd Zusman)
Subject: Autmatically invoking Perl code at script startup time.
Message-Id: <slrn630dhc.b3d.ljz@ljz.asfast.net>

I would like to install some Perl code that will automatically run at
the start of every Perl script that runs on my system.  This would be
analogous to the /etc/csh.cshrc commands which run at the start of
every csh script.

This Perl code must run even if no "use" or "require" or "do" calls
are made in the script.  In other words, the following two-line
program would cause this centralized startup Perl code to be invoked
before the 'print' statement gets executed:

   #!/usr/bin/perl
   print "Hi!\n";

I searched the FAQ and browsed the Perl library code, but I couldn't
find anything that explains this.  Even if this info exists, I'm not
sure what to look for in all this code and documentation.

The AutoLoader routines looked promising, but I don't see how to cause
any AutoLoaded code to get executed without specifically entering a
package via 'use'.  In order to do what I want, would I perhaps have
to set up an AutoLoad for the package 'main', or something?

As you can see, I'm at a loss about this.  Could anyone give me a
pointer to the pertinent information?

Thanks in advance.

-- 
 Lloyd Zusman
 ljz@asfast.com


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

Date: 30 Sep 1997 00:14:54 GMT
From: kayaalp@seas.smu.edu (Mehmet M. Kayaalp MD)
Subject: Can't display private variable values in debugging
Message-Id: <60pg9u$626$1@hermes.seas.smu.edu>

Sorry if this is a rather naive question for you, but couldn't
figure out after pondering on this issue after several hours:
I cannot see the value of a private variable declared in a
subroutine via my() when I am debugging.

Thanks in advance for sharing your wisdom with me.

mehmet
-- 
Mehmet M. Kayaalp       http://www.seas.smu.edu/~kayaalp
Computer Science Department, SMU, Dallas, TX, 75275-4191


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

Date: Mon, 29 Sep 1997 20:40:07 -0500
From: Joshua Udall <jaudall@students.wisc.edu>
Subject: chopping second to last char?
Message-Id: <34305876.414F9593@students.wisc.edu>

Josh-
>> When I open a VisualC++ source code file in Joe (using linux 2.0.27,
slackware)
>> all the ends of the lines have a blue M at the end.  The file will
not compile with
>> g++ either.  Why does this happen?

Doug-
> That's becuase UNIX and DOS signal end-of-line in two different
manners.
> DOS end-of-line is linefeed (^J) followed by carriage-return (^M).
> UNIX end-of-line is just linefeed.

In other words, DOS has (^J) and (^M) at the end of each line?

I wrote a little perl program that did just this (stripped the last
character) - and it worked.  However, instead of stripping the character
(^M) - it stripped all
the ^J (now I have one big line with ^Ms still in the code.)  Looks
like I need something to strip the second to last character.   I
included my perl script. Any suggestions or help would be appreciated?

Josh

PS please email response as well.



#!/usr/bin/perl
print "Which file to chop? \n";
$filename = <STDIN>;
print "What is the name of the new file? \n";
$newfile = <STDIN>;

chop($filename); #gets rid of pesky newline
chop($newfile);

if ( -r $filename && -w $filename) #file exists and I can read and write
to it
{
 open(INOLD, $filename) || die "cannot open $filename for reading";
 open(OUTNEW, ">$newfile") || die "cannot create $newfile";

 while (<INOLD>)
  {
  chop;
  print OUTNEW $_;
  } # end while

 close(INOLD);
 close(OUTNEW);

} # end if

else
{
 print "You don't have permission to mess with $filename.";
}




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

Date: Mon, 29 Sep 97 22:21:59 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: chopping second to last char?
Message-Id: <hqnifcgyjceezjk.pminews@user-38lcb2n.dialup.mindspring.com>

On Mon, 29 Sep 1997 20:40:07 -0500, Joshua Udall wrote:

>In other words, DOS has (^J) and (^M) at the end of each line?

Actually, the order is backwards.  The typical WinTel(and OS/2Tel)
line-ending is ^M^J.  

>Looks
>like I need something to strip the second to last character.

As usual, TMTOWTDI.  Assuming a line to be de-WinTeled is in $_, you
can explicitly nuke the 2nd to last char with

substr($_, length($_) - 2, 1) = '';

or you could kill ^Ms with

tr/\r//d;

or 

s/\r//;

Alternatively, you could do a double-chop and then restore the \n
when you output the line, which would change your code to

 while (<INOLD>)
  {
  chop;chop;
  print OUTNEW "$_\n";
  } # end while

Ben

-- 
Ben Coleman NJ8J                     | The attempt to legislatively
Internet: bcoleman@mindspring.com    | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.





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

Date: 30 Sep 1997 01:34:07 GMT
From: n1868683@droid.student.fit.qut.edu.au (Kenneth Blinco)
Subject: counting string occurences
Message-Id: <60pkuf$55r@dove.qut.edu.au>

hello,

would anyone be able to let me know of a good way to count the occurence of a particular string pattern in a file?

thanks in advance

ken  

--



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

Date: 30 Sep 1997 01:43:30 GMT
From: n1868683@droid.student.fit.qut.edu.au (Kenneth Blinco)
Subject: Re: counting string occurences
Message-Id: <60plg2$7pa@dove.qut.edu.au>

hello again :)  - just a note :  don't worry bout replying to this post cause i just found out that the search/replace operator returns the number of occurences. gee i should  RTFM  more often *heh* - sorry bout wasting anyone's time here.

ken

Kenneth Blinco (n1868683@droid.student.fit.qut.edu.au) wrote:
: hello,

: would anyone be able to let me know of a good way to count the occurence of a particular string pattern in a file?

: thanks in advance

: ken  

: --


--



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

Date: Tue, 30 Sep 1997 08:52:18 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: extracting between C comments?
Message-Id: <34302312.7CDE@ozemail.com.au>

Tad McClellan wrote:
> 
> California Man (jeep@rahul.net) wrote:
> : This might be easy, but I cant seem to do it.  Im trying to write
> : a perl utility that will extract code between 'C' style comments.
> [snip]

1. Download the Perl package Perceps, from http://friga.mer.utexas.edu/mark/perl/perceps/, which
happens to do this.

2. Buy:
Mastering Regular Expressions
Jeffrey Friedl
O'Reilly
1-56592-257-3
P 292.


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

Date: 29 Sep 97 19:07:55 GMT
From: bf@sparksintl.com
Subject: HERBAL ALTERNATIVE TO LIPOSUCTION -- NOW IN USA!
Message-Id: <342ffc8b.0@news1.tacoma.net>


For complete information, visit:  http://www.sparksintl.com


If you had told me a year ago that I would 
be marketing a product that claims it will
remove two inches of fat in 24 hours,
I would have laughed.  


HERE'S WHAT CHANGED MY MIND:

Last December, I pushed my doubts aside 
and tested the gel on my own "fat-prone 
areas" -- stomach, hips, and thighs.  
What happened just 24 hours later turned 
me, an avowed skeptic, into a wide-eyed
believer.  I lost 2-1/2" from my waist, 
2-1/2" from my hips, and 3-1/2" from each 
thigh -- overnight.  I was so stunned at
the results that my husband had to re-measure
me to finally convince me.

HOW OUR PRODUCT COMPARES TO OTHER PRODUCTS ON 
THE MARKET...

1.  It removes excess fat immediately, within 
24 hours.  You don't have to wait weeks or months 
for it to work as you do with some "body contouring"
products on the market.

2.  It liquefies fat naturally with common, European
herbs that have been used safely for centuries; the 
fat is then eliminated by the body naturally thru 
urination.

3.  It's 100% safe, 100% herbal, 
100% hypo-allergenic.

4.  Quick and easy to use, it takes less than
an hour to apply. 

5.  No side effects, no after-effects, no strange
sensations - just great results!

6.  It can be used repeatedly to lose multiple 
inches and maintain the fat loss over months, 
even years.

7.  Affordable even for people on a budget.

FOR COMPLETE INFORMATION ON:
a)  PRODUCT:  http://www.sparksintl.com
b)  BUSINESS OPPORTUNITY, reply to: info@sparksintl.com 




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

Date: Mon, 29 Sep 1997 15:55:15 -0700
From: S Page <spage@macromedia.com>
To: Greg Bacon <gbacon@cs.uah.edu>
Subject: how?! Re: Statistics for comp.lang.perl.misc
Message-Id: <343031D3.5AC76E31@macromedia.com>

Greg Bacon wrote:

> Following is a summary of articles spanning a 7 day period,

Amazing!  I just started reading this newsgroup because Macromedia runs a small set of
newsgroups, and I want to generate similar newsgroup stats to those that you just provided; the
only difference is, I would walk the spool directory in a recursive subroutine to process all
newsgroups.

Are your scripts available? Does anyone have similar scripts?  I went to
http://www.perl.org/CPAN/scripts/news/ but didn't see anything along these lines.  In my brief
Perl career I've written several report scripts and a recursive script, so my major task is
parsing the dates and other header information from news articles.

Thanks in advance for any pointers.




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

Date: Tue, 30 Sep 1997 02:14:28 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: NEEDED:    E-Mail Subroutine
Message-Id: <34305f44.1166112@news.wwa.com>

Mick Knutson (mknutson@us.oracle.com) said:
>I need a subroutine that I can call with a variable ($address), and have
>it validate e-mail addresses, and correct mistakes like:
>
>meta characters: delete them.
>spaces: delete them.
>Upper case: convert to lower case.
>
>And then send that variable back to the calling function.

to which dmacks@sas.upenn.edu (Daniel E. Macks) responded:
>This probably belongs in clp.misc instead of clp.modules? 

or better yet, as he did not mention the word 'perl', in
comp.infosystems.www.authoring.cgi.

>But anyway, for #2 just write it yourself...they are all *really* simple string
>s/ubsti/tution/ tasks, and there's even a builtin to do the last one.
>But do you really want to do that? 

Come on.  Just give him some untested subroutines.  If he can't read
the FAQ or post in the right newsgroup, he should get exactly the help
he asks for.  :-)

sub fix_mistakes {
$_ = lc(shift);
tr/`'\\"|*?~<>^()[]{}$\n\r //d;
$_;
}

sub validate_address {
join( ' ', shift, 'is a very good address');
} 

>Email addresses can have spaces 'n' metas. 

They also can have CAPITAL letters, but this is an issue for
comp.mail.misc.

>Which segues quite nicely into #1--perhaps RTFFAQ or DejaNews?

Exactly.  :-)  And a place he should consider starting is Lincoln D.
Stein's _The World Wide Web Security FAQ_ at
http://www.genome.wi.mit.edu/WWW/faqs/www-security-faq.html

>I'll summarize: can't be done.

Now, he won't read the FAQs.  :-(


Streben nach Wahrheit

Faust Gertz
Philosopher at Large


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

Date: Mon, 29 Sep 1997 15:54:07 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
To: brian d foy <comdog@computerdog.com>
Subject: Re: New Perl syntax idea
Message-Id: <3430318F.7515@ixlabs.com>

brian d foy wrote:
> 
> In article <34301FA7.5F09@ixlabs.com>, chris@ixlabs.com wrote:
> 
> >To eliminate the repetitive use of:
> >my $self = shift;
> >
> >Whose verbosity smells unperlish.
> 
> how would a method call look in such a case?  perhaps you could
> supply what you like a method would look like using this syntax...

The call would look the same. Assume a method 'SetProperty' which sets
or returns the value of a specified key in the object hash.

$objref->SetProperty('SOMEPROP','newval');

The method definition would be (assuming for example, $% as magic object
reference var):

method Method{
	my $propery = shift;
	my $newvalue = shift;

	if(defined $newvalue){
		$%->{$property} = $newval;
	}
	$%->{$property};
}


Now we have elimiated the need to do a
my $self=shift;

Since we have declared this sub a method, Perl knows the programmer has
relinquished his ability to get the object reference off the argument
stack in favor of the magic variable.

I must mention that this in no way is a watershed of usability - just a
Perl-like solution to repetitive syntax which seems out of place almong
other perl code.

Chris


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

Date: Mon, 29 Sep 1997 21:02:48 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: New Perl syntax idea
Message-Id: <comdog-ya02408000R2909972102480001@news.panix.com>

In article <3430318F.7515@ixlabs.com>, chris@ixlabs.com wrote:

>$objref->SetProperty('SOMEPROP','newval');
>
>The method definition would be (assuming for example, $% as magic object
>reference var):
>
>method Method{
>        my $propery = shift;
>        my $newvalue = shift;
>
>        if(defined $newvalue){
>                $%->{$property} = $newval;
>        }
>        $%->{$property};
>}

>Now we have elimiated the need to do a
>my $self=shift;

where does this magic variable live?  for instance, if the method
operates on another object which calls a method, what happens to
the magic variable?  how about if the method calls internal 
functions?

even if a syntax such as this were available, i would still end
up doing something like

   my $self = $MAGIC_VARIABLE;

since i like to give my objects names.  things are a lot easier
to maintain that way.

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Tue, 30 Sep 1997 01:26:08 GMT
From: jglosz@san.rr.com (Joseph)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <343053bd.11090408@news-server>

Gee, Abigail, thanks a lot.

On 29 Sep 1997 01:34:15 GMT, abigail@fnx.com (Abigail) wrote:

>Perhaps you shouldn't modify a program in any language if you
>don't know the language. 

That wasn't the advice I asked, Abigail, but thanks anyway.

>"Hey Doc, this has GOT to be the ultimate newbie question, but I don't
> know medication, and I need to fix the lung I'm dealing with while
> operating on my kid."

I'm sorry, Abs, I didn't know you owned this newsgroup.


>Yeah, something simple as that. And you find the answer by doing something
>simple as:
>
>$ man perlop | grep concatenate
>

You bring narrow minded twitness to a new high. What makes you think
I'm on a unix machine? I left the command line world behind a long
time ago.

In the future, please keep your thoughts to yourself. Thanks.




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

Date: Tue, 30 Sep 1997 01:29:01 GMT
From: jglosz@san.rr.com (Joseph)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <34325589.11550967@news-server>

On Sun, 28 Sep 1997 20:54:11 -0500, tadmc@flash.net (Tad McClellan)
wrote:

>
>   $value = "$name$value"; # this is called 'interpolation' but it
>                           # has the same effect if used as shown

Tad, thanks. I had read about the dot concatenation operator, and
about the join function, but I hadn't read this one yet. 

Thanks for a useful post!!




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

Date: Tue, 30 Sep 1997 01:27:31 GMT
From: jglosz@san.rr.com (Joseph)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <34315541.11478253@news-server>

Jefff, thanks. That works. The "join" function also works well. 

Thanks for a useful answer. Unlike old Abigail here. 


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

Date: 29 Sep 1997 21:46:14 -0400
From: Douglas McNaught <doug@tc.net>
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <m2raa7lgk9.fsf@ono.tc.net>

jglosz@san.rr.com (Joseph) writes:

> Gee, Abigail, thanks a lot.
> 
> On 29 Sep 1997 01:34:15 GMT, abigail@fnx.com (Abigail) wrote:

[...]

> >Yeah, something simple as that. And you find the answer by doing something
> >simple as:
> >
> >$ man perlop | grep concatenate
> >
> 
> You bring narrow minded twitness to a new high. What makes you think
> I'm on a unix machine? I left the command line world behind a long
> time ago.

It shows.

*plonk*

HAND...

-Doug
-- 
sub g{my$i=index$t,$_[0];($i%5,int$i/5)}sub h{substr$t,5*$_[1]+$_[0],1}sub n{(
$_[0]+4)%5}$t='encryptabdfghjklmoqsuvwxz';$c='fxmdwbcmagnyubnyquohyhny';while(
$c=~s/(.)(.)//){($w,$x)=g$1;($y,$z)=g$2;$w==$y&&($p.=h($w,n$x).h($y,n$z))or$x==
$z&&($p.=h(n$w,$x).h(n$y,$z))or($p.=h($y,$x).h($w,$z))}$p=~y/x/ /;print$p,"\n";


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

Date: 30 Sep 1997 02:46:18 GMT
From: mgjv@mali.comdyn.com.au (Martien Verbruggen)
Subject: Re: Newbie ques: How to concatenate two strings?
Message-Id: <60pp5q$vn$1@comdyn.comdyn.com.au>

In article <34315541.11478253@news-server>,
	jglosz@san.rr.com (Joseph) writes:
> Jefff, thanks. That works. The "join" function also works well. 
> 
> Thanks for a useful answer. Unlike old Abigail here. 

Hey, I happen to think that Abigail's answer was very useful. If you
don't know anything about the language, get someone else to do it, or
read the documentation. She was even friendly enough to provide you
with a pointer on how to read which documentation. In contrary to what a
lot of people keep stating: that was not platform dependent. Both man
and grep are simple executables, which I used to have on my DOS box a
long time ago. If you don't have a grep, get one. If you don't have or
like man, use perldoc.

Abigail's answer probably was this short, because you are not the only
one asking questions like this. We get loads of these sorts of
questions here, and the suggestion to read some documentation is
normally a fairly good one. 

If all people starting out with perl would read the documentation, or
at least the first few pages, the atmosphere would be better and the
willingness of people to give lengthy answers would be a lot higher.

Oh well, old argument 
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | In a world without fences, who needs
Commercial Dynamics Pty. Ltd.       | Gates?
NSW, Australia                      | 


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

Date: Mon, 29 Sep 1997 20:58:22 GMT
From: "Jean-Francois Deschenes" <deschenj@rc.gc.ca>
Subject: newbie question : crypt library
Message-Id: <01bccd33$5f957db0$42fc888e@beer_factory>

I have just started to learn perl and I was trying to create a password
file with the crypt function.  When i tried it at first it said crypt() not
implemented.  So i got the crypt library (international version) from my OS
site (SCO).  I installed it and it said installation successful, no
problem. 

I now have the libcrypt_i.a file but i still have the same problem with
perl.  I guess i must add this new library to perl but I don't know how. 
Do I have to reinstall perl or can just type a command?

I realize it's a very simple question but I have looked at the perl FAQ and
have not found an answer ( maybe i did not see it ).

Thank you

J-F Deschenes
deschenj@rc.gc.ca



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

Date: Mon, 29 Sep 1997 21:16:38 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Jean-Francois Deschenes <deschenj@rc.gc.ca>
Subject: Re: newbie question : crypt library
Message-Id: <343052F6.577D596A@mail.earthlink.net>

[posted & mailed]

I'm afraid you're going to have to reinstall perl to use the built-in
crypt() function.  You could roll your own XS interface to libcrypt, but
that would be much more work...

Benjamin Holzman


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

Date: 30 Sep 1997 01:31:10 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: nombre de champs de donnies
Message-Id: <60pkou$99f$1@bashful.rediris.es>

In <60i04c$a4$1@news1.tor.acc.ca>,
	lpcote@iq.ca <lpcote@iq.ca> wrote:
>Est-ce vrai qu'on ne peut pas mettre plus de 40 champs de donnies (ex.
>formulaires) dans un site Perl ?

C'est quoi, un "site Perl"? (Perl est un language de programation; rien
a voir avec des formulaires ou le WWW.)

ALain

-- 
Perl information: <URL:http://www.perl.com/perl/>
    Perl archive: <URL:http://www.perl.com/CPAN/>
        Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>
>>>>>>>>>>>>> NB: comp.lang.perl.misc is NOT a CGI group <<<<<<<<<<<<<<


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

Date: Mon, 29 Sep 1997 21:39:46 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Michael Mstowski <msm@spaceworks.com>
Subject: Re: Perl socket byte ordering question
Message-Id: <34305862.AA315191@mail.earthlink.net>

[posted & mailed]

> I'd like to do the same thing in perl 5.x.  How do you prefix
> the size of a string using two bytes in a portable way?
> 
> Thanks,
> Michael Mstowski
Well, assuming that your string is 65535 characters or less, here's how
you could do it:

$string = pack('n',length($string)).$string;

Then you could undo that on the other side like this:

$string = substr($buffer,1,($length=unpack('n',substr($buffer,0,2))));
susbtr($buffer,0,$length+2) = '';

Hope this helps!

Benjamin Holzman


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

Date: Mon, 29 Sep 1997 19:49:10 -0600
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Perl Venery
Message-Id: <34305A96.60C57FD6@gpu.srv.ualberta.ca>

brian d foy wrote:
> 
> have recently replied to a posting about LWP and using the phrase
> "family of modules", i thought that there must be better collective
> nouns for Perl thingy.
> 
> some of the obvious ones that don't necessarily deal with Perl:
> 
>    a namespace of variables
>    a package of methods
> 
> and so on.  surely the liguistically-leaning Perl types can come
> up with more aesthetic ones :)

I take it you don't like the somewhat mundane 'bundle of modules'?

perhaps the obvious choice is 'pod' (already in use for some
marine mammals) ... within perl it would then take on a dual
meaning depending on context (or cryptocontext as Tom C has
referred to it)...
scalar context: a module's pod
aggregate context: a pod of modules
and meanwhile, still retaining the rather subliminal message
that perhaps the 'body snatchers' wasn't just a movie after all.

:-)

regards
andrew


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

Date: Mon, 29 Sep 1997 22:52:42 -0400
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Perl4 is *not* Y2K (was Re: Y2K)
Message-Id: <-2909972252430001@aggie.coaps.fsu.edu>

In article
<Pine.GSO.3.96.970929135609.12373O-100000@usertest.teleport.com>, Tom
Phoenix <rootbeer@teleport.com> wrote:

+ On Mon, 29 Sep 1997, I R A Aggie wrote:
+ 
+ > So, you're saying that I should remove the perl4 that our vendor
+ > so thoughtfully included with their system software?

+ Well, then maybe you shouldn't remove it _today_. Instead, you can tell
+ your users that it's going to be discontinued, and they need to convert
+ their old scripts to work with 5.004 (which, of course, you currently have
+ installed :-). You move the binary to /usr/local/bin/perl4isdead and you
+ set up a temporary symlink to go from its current location to the new one,
+ but you tell everybody to use the new name if they want to keep using
+ perl4 during the next two weeks' grace period.

Fortunately, we have a small cgi-bin directory. I just cut out the 
middle-man, and converted everything over. Eventually, I'll get around
to the other odd tid-bits laying around, but I figured it would be wise
to eliminate the obvious security holes first...

Fortunately, there are only three or so of us doing perl, and the other
two are learning v5. I started with 4.036, so I still have some old, old
legacy code. G*d, that stuff looks so...barbaric.

James - of course, I was Just Another Perl Rookie (JAPR) then...

-- 
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: Mon, 29 Sep 97 22:10:54 -0400
From: samdie@ibm.net
Subject: References - saving & using (newbie)
Message-Id: <343062d8$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>

I wrote the script below to check my understanding of creating, saving and
later using references (to hashes but that shouldn't matter). With my input,
it should create two hashes of arrays, each hash being accessible via one/more
keys. I wanted to hash those keys to *references* to the first two hashes.

The 1st print shows what I expected; three keys mapped onto two tables. The
2nd print (which I expected to show the same thing (perhaps, in a different
order), show all three keys mapped onto a *single* reference (the last one
shown earlier).

I thought I was following "Programming Perl" (chap 4) pretty closely but
obviously, I'm missing something. Suggestions solicited.


sub config_line() { while (<STDIN>) { if (!(/^$/)) { chomp; return 1; } } }

sub make_HoL() {
  $h={};
  while (config_line() and substr($_,0,1) ne "#") {
    ($key,@vals)=split /,\s*/; $h{$key}=[ @vals ];
  }
  return \$h;
}

sub configure() {
  config_line();
  while (substr($_,0,2) eq "# ") {
    ($type,@versions)=split(" ",substr($_,2));
    last if ($type eq "ENDs");
    if ($type eq "APPs") {
      $HoL=make_HoL();
      foreach $v (@versions) {
        $apps{$v}=$HoL; print "$v ==> $$HoL\n"; # 3 keys ==> 2 hash refs
      }
    }
  }
  foreach $a (keys %apps) {
    $x=$apps{$a}; print "$a ==> $$x\n"; # same 3 keys ==> 1 hash ref (last)
  }
}
configure();
-- 
-----------------------------------------------------------
samdie@ibm.net
-----------------------------------------------------------



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

Date: Tue, 30 Sep 1997 00:56:20 GMT
From: ramonr@earthlink.net (Ramon Rodriguez)
Subject: Syntax Question using regular expressions.
Message-Id: <34304d8a.25707272@news.zippo.com>

I want to test a scalar variable to determine what kind of data it
holds (numeric or alphabetic)  If it's alphabetic I want to print
something out and exit the Perl script if it's numeric then do
nothing.  I was told to use regular expression pattern matching using
the /\D/ syntax but I don't know how to implement it in a simple if
statement.  I'd appreciate any help given.  TIA.   

					Ramon Rodriguez


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

Date: 30 Sep 1997 00:24:06 GMT
From: Gabor Egressy <gabor@vinyl.quickweb.com>
Subject: Re: Test for alphabetic character?
Message-Id: <60pgr6$ld2$1@flint.sentex.net>

Ramon Rodriguez <ramonr@earthlink.net> wrote:
: How can I test to see if some user input in a cgi script is text or
: numeric(what I'll accept) in Perl5?  Thanks in advance.

Depends on what you mean by 'text'.  Are these 2 lines not text just
because they contain a digit and some punctuation?
You could test for a digit with
\d or [0-9]  which are the same thing
print "number\n" if /^\d+(?:\.\d+)?$/;
will test for most numbers.

gabor.
--
    "It is easier to port a shell than a shell script."
        -- Larry Wall


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

Date: Tue, 30 Sep 1997 08:59:36 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Text::English
Message-Id: <343024C8.5797@ozemail.com.au>

Tom Phoenix wrote:
> 
> On Wed, 24 Sep 1997, Gene Hsu wrote:
> 
> > Can anyone show me where to find it/send me a copy?
> 
> Maybe it doesn't exist yet, because it's waiting for someone to adopt the
> project and write the module. That someone may be you. :-)  Good luck!
> 
> --
> Tom Phoenix           http://www.teleport.com/~rootbeer/
> rootbeer@teleport.com  PGP   Skribu al mi per Esperanto!
> Randal Schwartz Case:  http://www.rahul.net/jeffrey/ovs/
>               Ask me about Perl trainings!

Text::English, for 'stemming', eh?

I've written this twice, once in Pascal and once in Prolog. I'll fish around in my archives.

-- 
PO`!1a


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

Date: Tue, 30 Sep 1997 02:45:04 GMT
From: aaa@no-spam.tutoraid.org (Academic Assistance Access)
Subject: Tutors Needed for Programming Languages Mailing List
Message-Id: <343067a3.2695023@news.ican.net>


Academic Assistance Access is a free tutoring service on the Web
designed to offer assistance in the Programming Languages field for
students at post secondary level. If you are interested in sharing
your knowledge with today's youth why not join our tutor team. Help
make a major contribution towards excellence in higher education.

For more information:http://www.tutoraid.org/
or to subscribe http://www.tutoraid.org/team/

George Richards
Academic Assistance Access
http://www.tutoraid.org/
Tutors Needed for Programming Languages Mailing List


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

Date: 30 Sep 1997 03:34:30 GMT
From: Byron Brummer <zenin@best.com>
Subject: Re: write to variables
Message-Id: <60ps06$5ba$4@nntp2.ba.best.com>

Doug Simon <dsimon@dls.net> wrote:
	>sniped, not in original order<

> I have tried redirecting STDOUT to a file, and then reading the file:
> open(STDOUT,">$foo");
> write;
> This works fine, but I can not get regular STDOUT back!!

	open (STDOUT, ">-") or die $!;	## Or whatever filehandle name

	Although, it's probably better to use a different filehandle for
	write():

	open (OUT_PUT, ">$foo") or die $!;
	write OUT_PUT;

> I am trying to capture the output of:
> write;
> in a variable.

	Many ways to do this.  Now with 5.004 I tend to create a small tied
	handle class for this that mocks a filehandle.  This way I never
	actually open a file, but rather keep a "memory" filehandle.  There
	is probably a class that does this already, but I haven't found it.
	Here's my version:

	{
	    package MyVarHandle;
	    sub TIEHANDLE { return bless [] }
	    sub PRINT { my $obj = shift; push @{$obj}, @_ }
	    sub READLINE { my $obj = shift; return shift @{$obj} }
	}

	tie *HANDLE, 'MyVarHandle';
	print HANDLE "This is a test\n";
	print <HANDLE>;

	Yes, this actually works, although for write() you may have to define
	a couple other methods such as PRINTF.

> I have tried nerly everything!
	Except the man/pod pages.  Try, "perldoc -f write".

> 1) How do I get STDOUT back?
	Told you already. :)

> 2) Is there a better way to do this?
	Yes.

> Thanks,
	NP.

-- 
-Zenin (zenin@best.com)
 The Bawdy Caste (San Jose, CA)       http://www.netmagic.net/~dmcgrath/bawdy/
 Barely Legal   (Berzerkly, CA)                    http://www.barelylegal.org/
 Zenin's Rocky Archive (Moving soon!)              http://www.best.com/~zenin/


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

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

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