[12498] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6098 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 22 18:07:23 1999

Date: Tue, 22 Jun 99 15: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           Tue, 22 Jun 1999     Volume: 8 Number: 6098

Today's topics:
    Re: A month behind using localtime(time) ? <cassell@mail.cor.epa.gov>
    Re: A month behind using localtime(time) ? (Tad McClellan)
    Re: A month behind using localtime(time) ? (Tad McClellan)
    Re: aarrggghhh opening a file... <cassell@mail.cor.epa.gov>
        accessing a character in a string <fake@nospam.edu>
        AIX, sar and perl (what am I doing wrong?) jgruiz1@ibm.net
    Re: blank row in array <aqumsieh@matrox.com>
    Re: can you split a word into letters? (Fuzzy Warm Moogles)
    Re: DIE DIE DIE Prisoners of Bill <gbartels@xli.com>
        Displaying Adds j_a_p@my-deja.com
    Re: Does Perl have a future? (Joe Chan)
        Exit values on NT, and run via AT <mwood@mhw.ULib.IUPUI.Edu>
    Re: fdghfg <cassell@mail.cor.epa.gov>
    Re: Forking off a process <emschwar@rmi.net>
    Re: function to read a line & return it <cassell@mail.cor.epa.gov>
    Re: function to read a line & return it <zjagrantz@znrcanz.gcz.ca>
        HELP:  Talking to external device using RS-232 (M McDonald)
    Re: How to find and delete or replace a section in a li <aqumsieh@matrox.com>
    Re: How to find and delete or replace a section in a li <cassell@mail.cor.epa.gov>
    Re: How to find and delete or replace a section in a li (brian d foy)
    Re: Interpreting MS-ASCII - anyone have a filter? (Larry Rosler)
    Re: Is it better perl than awk ? <tchrist@mox.perl.com>
    Re: Looking for very small, basic bulletin board system ivanhead@my-deja.com
    Re: move file pointer? (Tad McClellan)
    Re: Newbie - Perl books - which to get? <cassell@mail.cor.epa.gov>
    Re: Newbie - Perl books - which to get? <aqumsieh@matrox.com>
    Re: Newbie - Perl books - which to get? (Lee)
    Re: Newbie:VBQ (Very Basic Question) (Edward P Scholl)
    Re: require libs <cassell@mail.cor.epa.gov>
    Re: Statistics for comp.lang.perl.misc <gbartels@xli.com>
    Re: Statistics for comp.lang.perl.misc <uri@sysarch.com>
    Re: Statistics for comp.lang.perl.misc (Lee)
    Re: Summing an array (brian d foy)
    Re: Summing an array (Larry Rosler)
    Re: virtualave.net <webmaster@chatbase.com>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 22 Jun 1999 14:03:14 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Mark Conlin <Mark.Conlin@bridge.bellsouth.com>
Subject: Re: A month behind using localtime(time) ?
Message-Id: <376FFA12.6CBEF35E@mail.cor.epa.gov>

[e-mail only - no newsgroup posting]

Mark Conlin wrote:
> 
> >    Sigh - why not read the docs to see why this is so?
> > It uses the underlying C library which does the same thing - also
> > documented.
> 
> Becuase I do not have a good book with me right now and in addition
> my connection is so slow that it is almost impossible to search
> through faqs online.

Mark, now that you have been harassed by the NG, you may not
want to listen to me.  But I hope this will be polite and
helpful.  Pretty novel for our newsgroup, eh?

Since you're using either Nyetscape or Internet Exploder to
post to Usenet, you've got *some* web access.  So don't use 
the FAQ that's thousands of miles away.  Make sure you've got
a copy on your own machine.  It's easier than it sounds.

For win32 machines, go to www.activestate.com and install
ActiveState Perl.  It uses the standard InstallShield wizard,
and it's quite fast.  It will put a shortcut to an HTML doc
tree on your Start Menu, so you'll never again have to go out
on the web to peruse the docs.  And you'll get a *lot* of
good stuff.  Directions on using Perl on your machine, and
on using the pieces which come with AS Perl.  The ActivePerl
FAQ and the regular FAQ.  All the 'manpages' which hold the
*real* documentation for the language, since they are more
up-to-date than any book you'll find.  All the docs for the
installed modules.  And when you use ppm to install new modules,
their docs will be tucked into the same HTML tree for easy
reading.

If you want something for a non-win32 system, you can go
to CPAN and download the docs there, in several different
formats.  

The docs are out there, just waiting to help you.  And once 
you have them on your own machine, you can search them however
you want, index them, whatever.  You'll never again have to
listen to some guru tell you to go RTFM or RTFFAQ.

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 12:23:44 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: A month behind using localtime(time) ?
Message-Id: <gadok7.25.ln@magna.metronet.com>

Mark Conlin (Mark.Conlin@bridge.bellsouth.com) wrote:
: > Stop programming by guesswork, or take up another trade.

: Now, be nice. 


   If you want folks to be nice, you shouldn't be rude to them.

   Unnice is a very common reaction to taking cuts in line.

   So, don't take cuts, or live with the grumbling (and killfiling).


: If is so troublesome of a task to read and reply to 
: this message that you feel the need to insult me then why did you
: do it ? No one is forcing you to respond. 


   There are *hundreds* of "you" doing it though.

   Nothing personal.


: I don't have a reference book here and my connection is so terrible
: that it makes using the web faqs impossible. 


   So don't use the "web faqs" (whatever those are) then.

   Use the docs that *come with* the perl distribution.

   Perl is free you know. You can install it on whatever computer
   it is that you are using to post to Usenet, then you can get
   *definitive* answers in seconds instead of posting to Usenet
   and hoping that whoever answers is not a script kiddie...


: In addition the fact that
: I did not understand the behavior of a perl command does not mean that
: I need to switch jobs. 


   The fact that you used the localtime() function without reading
   what the localtime() function does, *does* indicate that you
   are in the wrong line of work.

   No Professional Programmer would use a function without reading
   the "contract" (i.e. docs) that the author of the function has
   signed up to provide.

   Well, they might not read it at first, but they most certainly
   would have checked it when they found that it wasn't working
   right, because they wouldn't want to embarrass themselves
   in front of thousands of people.





A Larry quote from my archives:


In article <1995Nov9.193745.13694@netlabs.com>, lwall@netlabs.com (Larry
Wall) wrote: ...

<Larry>  [snip]  I view a programming language as a place to be
<Larry>  explored, like Disneyland. You don't need to have a lot of preparation
<Larry>  to explore a theme park.  You do have to go along with the crowd
<Larry>  control measures, though.  In a sense, each ride has its own
<Larry>  prerequisites--if you cut in line, you risk getting tossed out of the
<Larry>  park.
<Larry> 
<Larry>  What we have here in this newsgroup is a failure in crowd control.
<Larry>  Reading the FAQ is like staying in line--it's something you should
<Larry>  learn in kindergarten.  Usenet needs a better kindergarten.



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


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

Date: Tue, 22 Jun 1999 12:27:52 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: A month behind using localtime(time) ?
Message-Id: <8idok7.25.ln@magna.metronet.com>

Eric The Read (emschwar@rmi.net) wrote:
: bart.lateur@skynet.be (Bart Lateur) writes:
: > Eric The Read wrote:
: > >Did you actually read the documentation of localtime?  If you had, you'd
: > >have seen this behaviour explicitly documented.
: > >
: > >> Does that mean that January is $mon 0 ?
: > >
: > >Wow, you *are* good.
: > 
: > Nope. It says that the range for the months is 0..11, but it doesn't say
: > which month is 0.

: Eerily enough, so does my manpage for localtime(2).  So now nobody knows
: what it is!  Quick, everybody stop using tm_mon, until we can get
: clarification from the USENET Cabal(tinc) on this important matter!


   I think we should ask Joyclyn how to fix it, she knows (heh, heh)
   a lot about that kind of stuff.


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


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

Date: Tue, 22 Jun 1999 14:28:28 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: aarrggghhh opening a file...
Message-Id: <376FFFFC.2ADF446A@mail.cor.epa.gov>

Casey Tweten wrote:
>   Tom Phoenix <rootbeer@redcat.com> wrote:
> > > open IDOUT, ">$forumfile" || die "Couldn't open: $!";
> >
> > That's a good try, but it's not doing what you want. Check the
> precedence
> > chart and try again. Cheers!
> 
> *oye*  open ( IDOUT, ">$forumfile" ) || die "Couldn't open: $!";

<pedantic>
You misspelled 'oy' also.
</pedantic>  :-)

I prefer 'or' in the above construct so I don't hit the
precedence wall here.

open IDOUT, ">$forumfile" or die "Couldn't open: $!";

No savings on number of characters (sorry, LR  :-) but
I like it.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 14:35:26 -0700
From: "Ariel" <fake@nospam.edu>
Subject: accessing a character in a string
Message-Id: <7kovfe$osr@news.or.intel.com>

hi. you know how in C you can say

char mystring[ ] = "hello";
char myletter = mystring[1];  #myletter is the character 'e'

is there a way to do a similar thing in Perl? how do you access certain
characters in strings?

thanx
ariel




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

Date: Tue, 22 Jun 1999 21:10:31 GMT
From: jgruiz1@ibm.net
Subject: AIX, sar and perl (what am I doing wrong?)
Message-Id: <7kou3t$ka0$1@nnrp1.deja.com>

I have the following perl script. Which is supposed to execute
the UNIX 'sar' command, descard any header information from the
sar output and save the performance data in an output file.

The script works, but it never saves data to the output file
"sar.out" until the close(SARF) gets executed. What should I
do to save data to the output file after every sample (line)?

Any ideas?? by the way, I am running perl 5.004_04 under AIX
4.3.2.

Thanks,
Juan

----- script starts here -----
#!/usr/bin/perl

use FileHandle;

sub collect_sar
{
  my($samples,$interval,$outf)=@_;
  open(SARF,">$outf");
  autoflush SARF;
  @fargs=("/usr/sbin/sar",$interval,$samples);
  open(SAR,"@fargs|");
  autoflush SAR;

  while(<SAR>) {
    if ( /^\d\d:\d\d:\d\d\s+\d+\s+\d+\s+\d+\s+\d+/ ) {
      print SARF $_;
    }
  }
  close(SAR);
  close(SARF);
} # end collect_sar

&collect_sar(15,5,"sar.out");

----- script ends here -----


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 22 Jun 1999 15:51:48 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: blank row in array
Message-Id: <x3yr9n4c8tn.fsf@tigre.matrox.com>


Michael Hill <l463520@lmtas.lmco.com> writes:

> Shouldn't I  be able to create the array empty instead of with a blank
> row?

would you please explain what a "row" of an array is? As far as I
know, arrays in Perl are one dimensional.



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

Date: 22 Jun 1999 21:38:17 GMT
From: tgy@chocobo.org (Fuzzy Warm Moogles)
Subject: Re: can you split a word into letters?
Message-Id: <7kovo9$abg$0@216.39.141.200>

On Tue, 22 Jun 1999 08:09:25 -0700, lr@hpl.hp.com (Larry Rosler) wrote:

>> In article <slrn7mrfec.k1b.abigail@alexandra.delanet.com>,
>>   abigail@delanet.com wrote:
>...
>> > sub pohc (@) {
>> >     my $r;
>> >     foreach my $s (@_  ?
>> >                    @_  :
>> >                    $_) {
>> >         $s = reverse $s;
>> >         $r = chop    $s;
>> >         $s = reverse $s;
>> >     }
>> >     $r;
>> > }
>
>I couldn't bring myself to time this one, because it is so 'obviously' 
>facetious.  But the 'split' suggestions (in this and another thread) 
>weren't.

I couldn't bring myself not to time it.  After all, you wrote the benchmark,
Abigail provided the code, and all I had to do was copy and paste. :)

>Considering how many readers may not realize what 'Perl humor' is, or 
>may not have the skills yet to differentiate unlabeled humor from 
>serious answers, this trend is turning cruel and perhaps costly.  If 
>we're trying to be funny, we should say so.

Do not disparage Abigail's reverse chop.  It actually does pretty well,
beating out the more serious split suggestions.

#!/usr/bin/perl -w

use strict;
use Benchmark;

my $word = 'internationalization';

timethese(250000, {
  Regex  => sub { $word =~ /(.)/; $1 },
  Split0 => sub { (split //, $word)[0] },
  Split1 => sub { (split //, $word, 2)[0] },
  Substr => sub { substr $word, 0, 1 },
  Pohc   => sub { local $_ = reverse $word; chop },
});

__END__
Benchmark: timing 250000 iterations of Pohc, Regex, Split0, Split1, Substr...
      Pohc:  1 wallclock secs ( 1.59 usr +  0.00 sys =  1.59 CPU)
     Regex:  2 wallclock secs ( 1.27 usr +  0.00 sys =  1.27 CPU)
    Split0: 16 wallclock secs (14.89 usr +  0.00 sys = 14.89 CPU)
    Split1:  3 wallclock secs ( 2.58 usr +  0.00 sys =  2.58 CPU)
    Substr:  1 wallclock secs ( 0.54 usr +  0.00 sys =  0.54 CPU)
-- 
Fuzzy | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=


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

Date: Tue, 22 Jun 1999 16:27:37 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: DIE DIE DIE Prisoners of Bill
Message-Id: <376FF1B9.CA75D2A8@xli.com>

Scratchie wrote:
QU 
OT Steffen Beyer <sb@sdm.de> wrote:
ED : Why not just ignoring them?
QU : You're making your life miserable yourself.
OT 
ED : Relax, calm down! Go fishing! Or whatever relaxes you. :-)
QU 
OT Unfortunately, I think this *is* what relaxes him! :)
ED

A quick spook op on Tom's system uncovered an installation
of Quake and a personalized mission pack. In one particular
setup, several bad guy characters had been transformed into:

NG posters asking questions answered by FAQ's
NG posters asking non-perl questions
NG posters exceeding 75 columns and wrap-mangling text.

and several other mean and nasty characters.

Greg


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

Date: Tue, 22 Jun 1999 21:30:04 GMT
From: j_a_p@my-deja.com
Subject: Displaying Adds
Message-Id: <7kov8d$kn1$1@nnrp1.deja.com>

I want to write a simple function that displays adds and changes the
picture every so often.  I know this can be done using JavaScript, but
it has been so long since I have used this language I don't know where
to get started.  Could someone help or suggest a site that could answer
my question.  The type of thing I am talking about is like what apears
at the top of the deja page.  An add apears and after a while an knew
add appears.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 22 Jun 1999 21:15:15 GMT
From: joechan25@hotmail.com (Joe Chan)
Subject: Re: Does Perl have a future?
Message-Id: <376ff70a.2168383@news.force9.net>

Hi, I was asking in my ISP's cgi newsgroup about the possibility of
installing mod_perl. This is the reply I got from another user

There are a number of downsides to doing this:
1) Memory usage. The Apache process can take up large amounts of
memory if a lot of different modules are requested and a lot of
different scripts are run.
2) A lot of scripts use global variables. Since there is effectively
only one copy of Perl running, any global variables set by a script
are available to other scripts and scripts that don't bother
initialising their global variables will start off with the wrong
values.
3) Configuration. It is actually quite difficult to set this up to
work efficiently.
4) Development. Because a script is cached by the process you cannot
simply upload a new version and expect Apache to serve it correctly. I
think you have to either restart the Apache process or send it a
signal that causes it to flush the cache.
5) Reliability. mod_perl is really designed for fairly static CGI
servers where the scripts are tested thoroughly before being available
via the enhanced server. It is possible for badly written scripts to
interfere with other scripts and even cause the Apache process to
crash. This would be a nightmare for the System Adminstrators.

Are these criticisms valid? If so are they also true of Java Servlets
and Java Server Pages? Is mod_perl a viable facility for ISP's to
supply to subscriber's homepages or is it more suited to Corporate
Intranets or larger web sites running their own servers?

<snip>
>Take a look at some info about mod_perl and fastcgi, etc. I know what
>you're saying, and spawning so many processes can be murder on your
>system, but if you take advantage of such things, then any complaint
>anyone can use in such a manner is no longer valid. 
<snip>




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

Date: 22 Jun 1999 21:25:56 GMT
From: "Mark H. Wood" <mwood@mhw.ULib.IUPUI.Edu>
Subject: Exit values on NT, and run via AT
Message-Id: <7kov14$bqa$1@hercules.iupui.edu>

I've installed ActiveState's Perl port on an NT box, and I'd like to
run a script daily out of the scheduler service (AT and friends).  My
script works well when I run it manually, but when run by the
scheduler it silently exits, returning the value 9009 in ERRORLEVEL.
I tested it as a user with full rights, and scheduler runs with fewer
rights but should have sufficient rights to read and write the files
that my script wants.

I *know* I've seen something about this 9000 stuff somewhere in the
documentation but I can't find it.  Pointers welcomed.

Are there any special tricks to making AS Perl run well out of the
scheduler?

-- 
Mark H. Wood, Lead System Programmer   mwood@IUPUI.Edu
Specializing in unusual perspectives for more than twenty years.


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

Date: Tue, 22 Jun 1999 14:56:50 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: fdghfg
Message-Id: <377006A2.EC1FFB38@mail.cor.epa.gov>

Darren Boyle wrote:
> 
> dfghdfgd

Hmmmm.  That's far from the worst question we've seen today.
But I think it's a FAQ.  You'll probably want to use split()
and tr() .

HTH, 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: 22 Jun 1999 15:13:46 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Forking off a process
Message-Id: <xkfn1xskkfp.fsf@valdemar.col.hp.com>

Andy Walden <andy@mtco.com> writes:
> I am currently faced with an issue where I am trying to fork off a
> process that executes a set of commands in a shell script and then
> sends the user on elsewhere, mailing the results of the report
> later. Current I am trying to use:
> 
> if (fork)
> {
> exec ("/backup/usage/web-reports/web-usage-report $username"); };
> 
> Its not working out so well.

That's not surprising, considering it's wrong.  Read the documentation
for fork ("perldoc -f fork") to see why.  Hint: it's in the second
sentence.

> Any ideas are appreciated. Please CC me in the response.

Done, since you haven't apparently munged your address

-=Eric


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

Date: Tue, 22 Jun 1999 14:33:45 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: function to read a line & return it
Message-Id: <37700139.6C59875D@mail.cor.epa.gov>

Mike Coffin wrote:
> 
> David Cassell <cassell@mail.cor.epa.gov> writes:
> 
> > Not all of us are that grumpy, you know [yes, I saw the smiley].
> > I prefer to think of list vs scalar context as one of the
> > strengths of Perl, rather than one of the annoyances.  Once you
> > learn to grok it, you'll find that it is incredibly useful.
> >
> > @time_stuff = localtime;
> > $time_stuff = localtime;
> >
> > for example.
> 
> Wouldn't you agree that replacing the second line with
> 
>   $time_stuff = ctime();
> 
> would not be *that* much harder to use or less useful?

Umm, Mike, I think you missed the point I was trying to make.
Such as it was.  And of course, Larry Rosler pointed out a
rather cute context issue which is probably a better argument.

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 17:42:12 -0400
From: "John A. Grant" <zjagrantz@znrcanz.gcz.ca>
Subject: Re: function to read a line & return it
Message-Id: <7kp02h$2ke17@nrn2.NRCan.gc.ca>

David Cassell wrote in message <376FBB13.BE2A843C@mail.cor.epa.gov>...
[...]
>I prefer to think of list vs scalar context as one of the
>strengths of Perl, rather than one of the annoyances.  Once you
>learn to grok it, you'll find that it is incredibly useful.
>
>@time_stuff = localtime;
>$time_stuff = localtime;
    Yes, that's definitely a strength. It's similar to the
    operator/function overloading in C++ where the compiler
    chooses the Right Thing based on context/syntax.

--
John A. Grant  * I speak only for myself *  (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here






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

Date: Tue, 22 Jun 1999 21:00:09 GMT
From: opanlst@dcdi.net (M McDonald)
Subject: HELP:  Talking to external device using RS-232
Message-Id: <3775f93b.90922199@LWAFBDC>

I am a Perl programming Newbie.  I am trying to build a 'Serial-to-TCP
Port' gateway using a Linux box and Perl.  I have bought a bunch of
books on Perl (most of them from O'reilly publishing) to research
this.  I have found ..some.. information of rs-232 communication but
it is all Win32 based.

I have two (2) devices that constantly broadcast a 10 digit text
string out their rs-232 ports.  I want the Linux box to retreive these
text strings (via its two serial ports) and broadcast them across my
TCP/IP based network from given TCP ports.  I have another 'client'
application that will retrieve and convert the data into 'human
comprehendable' information.

Any and all help would be greatly appreciated.  Any push towards an
information resource (web or books) that could help me will be
welcomed.


			Michael McDonald
			(Operations Analyst)
			opanlst@dcdi.net or
			mrmcdon@bigfoot.com


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

Date: Tue, 22 Jun 1999 16:09:23 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: How to find and delete or replace a section in a line
Message-Id: <x3ypv2oc80c.fsf@tigre.matrox.com>


"Vox" <v0xman@yahoo.com> writes:

> If I have a string such as:
> 
> "ineedhelpinfindinganddeletingasectioninastring"
> 
> and the section of this line above that I want to delete or replace is
> 'findinganddeleting'
> Does anyone have any suggestions?

Is "read the FAQs" a good suggestion to you?

>From perlfaq5:

	How do I change one line in a file/delete a line in a
	file/insert a line in the middle of a file/append to the
	beginning of a file? 

Also, have a look at perlre for more info on regexps. The substr()
might also be useful here.

HTH,
Ala



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

Date: Tue, 22 Jun 1999 14:42:24 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to find and delete or replace a section in a line
Message-Id: <37700340.1C530204@mail.cor.epa.gov>

Vox wrote:
> 
> If I have a string such as:
> 
> "ineedhelpinfindinganddeletingasectioninastring"
> 
> and the section of this line above that I want to delete or replace is
> 'findinganddeleting'
> Does anyone have any suggestions?

You might want to use perldoc (or man or your browser) to read
whatever version of the docs you prefer, and check out the
substr() function.
 
HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 18:00:55 -0400
From: brian@pm.org (brian d foy)
Subject: Re: How to find and delete or replace a section in a line
Message-Id: <brian-ya02408000R2206991800550001@news.panix.com>

In article <37700340.1C530204@mail.cor.epa.gov>, David Cassell <cassell@mail.cor.epa.gov> posted:

> Vox wrote:
> > 
> > If I have a string such as:
> > 
> > "ineedhelpinfindinganddeletingasectioninastring"
> > 
> > and the section of this line above that I want to delete or replace is
> > 'findinganddeleting'
> > Does anyone have any suggestions?
> 
> You might want to use perldoc (or man or your browser) to read
> whatever version of the docs you prefer, and check out the
> substr() function.

i think i'd go for s/// myself.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Tue, 22 Jun 1999 14:15:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <MPG.11d99cb7e04b8ff989c21@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <x7aets89ow.fsf@home.sysarch.com> on 22 Jun 1999 12:46:39 -
0400, Uri Guttman <uri@sysarch.com> says...
> >>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
> 
>   >> "\x91"  => '`',
>   >> "\x92"  => "'",
> 
>   LR> Having just used this program on some Redmondware output, I would now 
>   LR> change that one to '&acute;', to match the backtick "\x91" better.  Some 
>   LR> of the others might use some more thought too.  I didn't look into the 
>   LR> substitutions when I massaged the program.
> 
> this is a tricky call. you fixed our paper that way and the ' (single
> quote) char after translation to &acute; is leaning way too far right
> for my taste. maybe just converting it to ' is ok.

I just rechecked the appearance of &acute; using Netscape Navigator 4 
and M$IE 5, and they look symmetric with the backtick, i.e., just fine.  
Are there any other browsers that anyone cares about?  <Ducking. :->

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 22 Jun 1999 15:01:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Is it better perl than awk ?
Message-Id: <376ff9a9@cs.colorado.edu>

     [courtesy cc of this posting mailed to cited author]

In comp.lang.perl.misc, 
    fmgst+@pitt.edu (Filip M. Gieszczykiewicz) writes:
:[1] Hehehe... recursion is to shell what AI is to FORTRAN ;-)

Oh, I don't know about that. :-)

#!/bin/csh -fv
# fully recursive (see penultimate line) numeric quicksort in the idiot csh
# 	by tchrist@perl.com's evil twin, 18 october 94

enod:
	if ($#argv == 2) 	goto lopo
	set a = `cat`
	echo $a | $0 1 $#a
				goto done
lopo:
	set a = `cat`;
	@ l=$1 r=$2
	if ($r > $l) 		goto node
	echo $a 
				goto done
node:
	@ v = $a[$r] 
	@ i = $l - 1
	@ j = $r
loop:
	@ i ++
	if ($a[$i] < $v ) 	goto loop
opol:
	@ j --
	if ( $a[$j] > $v ) 	goto opol
	if ($i >= $j) 		goto pool
	@ t = $a[$i]
	@ a[$i] = $a[$j]
	@ a[$j] = $t
				goto loop
pool:
	@ t = $a[$i]
	@ a[$i] = $a[$r]
	@ a[$r] = $t
	@ t1 = $i - 1
	@ t2 = $i + 1
	echo $a | $0 $l $t1 | $0 $t2 $r
done:
-- 
"Only the shallow know themselves" 
				- Oscar Wilde


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

Date: Tue, 22 Jun 1999 20:47:48 GMT
From: ivanhead@my-deja.com
Subject: Re: Looking for very small, basic bulletin board system
Message-Id: <7kospg$jos$1@nnrp1.deja.com>

Oh, I'm ecstatic.

Could you perhaps give me a some more useful information?

thanks
-- yvan



In article <376FD6EE.C7E6486F@mail.cor.epa.gov>,
  David Cassell <cassell@mail.cor.epa.gov> wrote:
> yvan@wharris.com wrote:
> >
> > I need a very small and basic bulletin board system for use in a web
> > page.  What I would like is a cgi script that would allow me to do
the
> > following:
> > [snip]
> >   Would anyone
> > here know where I might find a script that would allow me to do
this?
> > Your assistance would be much appreciated.
>
> You'll be happy to know that there's a thousand of these on the
> web.  Just don't go to Matt's Script Archive.  Happy searching!
>
> David
> --
> David Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 22 Jun 1999 11:56:02 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: move file pointer?
Message-Id: <imbok7.25.ln@magna.metronet.com>

bing-du@tamu.edu wrote:

: I have a code snippet.  It prints out all those lines in the file that
: match the specific patterns.

[ snip "super-inefficient" code]

: My question is:
: Instead of opening and closing the file repeatedly, is there any way to
: let the file pointer point to the first line of the file for the next
: pattern checking?  


   perldoc -f seek
   perldoc -f open  ( you want "+< filename" )


: Or any other better way for doing this?


   Yes, but you already knew that there is a better way, because
   you scanned the Perl FAQs to see if there was anything that
   would help you with your particular problem and you say this
   in part 6:

      "How do I efficiently match many regular expressions at once?"



: Thanks in advance for your suggestions and ideas,

   If you are truly thankful, then you should check the Perl FAQs
   and docs *before* posting to the Perl newsgroup!


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


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

Date: Tue, 22 Jun 1999 14:19:53 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Newbie - Perl books - which to get?
Message-Id: <376FFDF9.78253FA2@mail.cor.epa.gov>

Rhonda Nowak wrote:
> 
> Hi All,
> I looked on Amazon for Perl books and found quite a few.  I would like
> to order a couple.  Here is my narrowed list:
> 
> Beginner Level -
> Learning Perl (2nd Edition) - Randal L. Schwartz

That's Randal L. Schwartz and Tom Christiansen.  Please don't
leave Tom's name off.  He's a very sensitive soul.

If you have some programming background, this is *the* intro
to get.  If you have no real programming background, then I
suggest you start with some of the on-line tutorials, like
http://www.netcat.co.uk/rob/perl/win32perltut.html , and
when you have mastered them, *then* hit 'Learning Perl'.

Just beware of one little detail.  'Learning Perl' starts
off on a quick tour that shows the power of the language.
Don't worry if you get lost.  It's only a demo, not Randal
and Tom's teaching style.  Once that's over, then they'll
teach you Perl.. but you'll have some idea of what goodies
are coming.

> Teach Yourself Perl 5 in 21 Days - David Till

Well, you'll teach yourself *something*.. but maybe not quite
what most of us around here call 'Perl'.  Not the worst book
on the planet, but not the best either.
 
> Advanced Level -
> Effective Perl Programming: Writing Better Programs with Perl - Joseph
> N. Hall
> Programming Perl (2nd Edition) - Larry Wall

These two are good.  So are the Ram (The Perl Cookbook) 
and the Black Leopard (Advanced Perl Programming).  Go
for all four.

> Perl: The Programmer's Companion - Nigel Chapman

I don't know enough about this one personally to make a
recommendation, but you can read a quick review of it at
http://www.perl.com/perl/critiques/index.html  .
 
> I read reviews on Amazon, but would like to hear from anyone who
> knows/has heard of these books.  Please help me decide which would be
> best for me (beginner) and our more experienced Perl programmer.

I also found the docs which come with Perl were quite impressive
too.  Don't overlook that freeware!

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 16:26:46 -0400
From: Ala Qumsieh <aqumsieh@matrox.com>
Subject: Re: Newbie - Perl books - which to get?
Message-Id: <x3yogi8c77e.fsf@tigre.matrox.com>


Rhonda Nowak <rmn@itol.com> writes:

> Beginner Level -
> Learning Perl (2nd Edition) - Randal L. Schwartz

Excellent book .. the second edition has some unknown co-author by the
name of Tom Christiansen .. ever heard of him?
This is one of the best books you can buy if you want to learn Perl.

> Teach Yourself Perl 5 in 21 Days - David Till

Dunno .. haven't read that one.

> Advanced Level -
> Effective Perl Programming: Writing Better Programs with Perl - Joseph
> N. Hall

Haven't read all of it, but it's very good. Don't attempt to read it
before you have a good grasp on Perl though.

> Programming Perl (2nd Edition) - Larry Wall

A must-have reference. Besides being written by the creator of Perl,
it is also co-authored by R. Schwartz, and the unknown Christiansen.

> Perl: The Programmer's Companion - Nigel Chapman

Haven't read that one either.

> I read reviews on Amazon, but would like to hear from anyone who
> knows/has heard of these books.

Yeah it's tough. Some people are just hard to find, you know.

;-)

On a more serious note, I would like to suggest the Ram (aka the Perl
Cookbook), written buy (who else) T. Christiansen and N. Torkington,
published by O'Reilly. It is the *BEST* cookbook you'll find on Perl.

HTH,
Ala



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

Date: Tue, 22 Jun 1999 16:50:22 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Newbie - Perl books - which to get?
Message-Id: <B3956F4E966812BAF3@204.112.166.88>

In article <376FB0D7.643584DE@itol.com>,
Rhonda Nowak <rmn@itol.com> wrote:

>Hi All,
>I looked on Amazon for Perl books and found quite a few.  I would like
>to order a couple.  Here is my narrowed list:
>
>Beginner Level -
>Learning Perl (2nd Edition) - Randal L. Schwartz
>Teach Yourself Perl 5 in 21 Days - David Till
>
>Advanced Level -
>Effective Perl Programming: Writing Better Programs with Perl - Joseph
>N. Hall
>Programming Perl (2nd Edition) - Larry Wall
>Perl: The Programmer's Companion - Nigel Chapman

1) Any book with "in xx days" or "dummies" in the title is a complete waste
   of money. If you actually read them, the money is worse than wasted.

2) Someone here will be interested to know that amazon.com is giving him no
   credit for his co-authorships. :)

3) Learning/Programming Perl are excellent books. Add The Perl Cookbook to 
   the list, and you probably have everything you'll ever need.

4) The other two I don't know, but I've heard good things said of the 
   Chapman book.

5) I think that second heading should read "Intermediate." There are a few
   advanced books if you aspire to guru status.

Lee




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

Date: 22 Jun 1999 17:31:25 -0400
From: scholl@hercules.acsu.buffalo.edu (Edward P Scholl)
Subject: Re: Newbie:VBQ (Very Basic Question)
Message-Id: <7kovbd$qfd$1@hercules.acsu.buffalo.edu>

Stuart, Xinlu and Niuniu (stannehi@tu.infi.net) wrote:
: I just purchased a book "Perl 5 By Example" that came with perl5 on a
: cd. I installed it, it appears to be working. I typed   print("blah blah
: blah ,\n");      in notepad and named it test.pl
: Tried to run it and nothing happened. I know this is beyond basic but I
: would appreciate any help I could get. I am doing all of this in the
: windows98 environment (if that even matters)

when you saved it in notepad, did you make sure that you had file type
set to "all files (*.*)"?  otherwise notepad probably stuck a .txt at
the end of it, naming your file test.pl.txt

-ed



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

Date: Tue, 22 Jun 1999 14:06:54 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: require libs
Message-Id: <376FFAEE.5E832114@mail.cor.epa.gov>

Tom Christiansen wrote:
>     johnstonk@my-deja.com writes:
> :I am trying to run a Selena Sol forms
                        ^^^^^^^^^^^^^^^^
> :processing cgi script supposedly revised for NT
                                    ^^^^^^^^^^^^^
> mistake #1.

Isn't this two different mistakes? 
 
>     "His super power is to turn into a scotch terrier."

"His super power is the ability to hit on other superheroes'
girlfriends."  - David Letterman
 
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 16:12:00 -0400
From: Greg Bartels <gbartels@xli.com>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <376FEE10.F1FF67F4@xli.com>

Lee wrote:
Q 
U In article <1dtt53a.yov94bavpsleN@roxboro0-0035.dyn.interpath.net>,
O planb@newsreaders.com (J. Moreno) wrote:
T 
E >The more people that use the standard quoting style the easier it is
to
D >convince newsreader authors that they should recognize that there
/is/ a
Q >standard.
U 
O I have some ODD (oppositional-defiant) friends who could give everyone
here
T lessons on non-conventional newsreader configuration.
E 
D Lee


would you have an example?
Greg

;)


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

Date: 22 Jun 1999 17:14:34 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <x7n1xs6ipx.fsf@home.sysarch.com>

>>>>> "GB" == Greg Bartels <gbartels@xli.com> writes:

  GB> Lee wrote:
  GB> Q 
  GB> U In article <1dtt53a.yov94bavpsleN@roxboro0-0035.dyn.interpath.net>,
  GB> O planb@newsreaders.com (J. Moreno) wrote:
  GB> T 
  GB> E >The more people that use the standard quoting style the easier it is
  GB> to
  GB> D >convince newsreader authors that they should recognize that there
  GB> /is/ a
  GB> Q >standard.
  GB> U 
  GB> O I have some ODD (oppositional-defiant) friends who could give everyone
  GB> here
  GB> T lessons on non-conventional newsreader configuration.
  GB> E 
  GB> D Lee

but your wrapping sucks.

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Tue, 22 Jun 1999 16:50:22 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <B3956F4E966812BACA@204.112.166.88>

In article <376FEE10.F1FF67F4@xli.com>,
Greg Bartels <gbartels@xli.com> wrote:

>Lee wrote:
>Q 
>U In article <1dtt53a.yov94bavpsleN@roxboro0-0035.dyn.interpath.net>,
>O planb@newsreaders.com (J. Moreno) wrote:
>T 
>E >The more people that use the standard quoting style the easier it is
>to
>D >convince newsreader authors that they should recognize that there
>/is/ a
>Q >standard.
>U 
>O I have some ODD (oppositional-defiant) friends who could give everyone
>here
>T lessons on non-conventional newsreader configuration.
>E 
>D Lee
>
>
>would you have an example?
>Greg

The best of the lot doesn't post much any more, but you could search the
archives for alt.alien.vampire.flonk.flonk.flonk, "El Rocko".

Trust me, you don't want to see one reproduced here.

(Uri: ghastly wrapping is an intentional and integral part of the art form)

Lee




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

Date: Tue, 22 Jun 1999 17:29:35 -0400
From: brian@pm.org (brian d foy)
Subject: Re: Summing an array
Message-Id: <brian-ya02408000R2206991729350001@news.panix.com>

In article <ant222033f00Lh==@ch0128.charis.co.uk>, James Stewart <james@britlinks.co.uk> posted:

> In article <376feb19@cs.colorado.edu>, Tom Christiansen
> <URL:mailto:tchrist@mox.perl.com> wrote:
> >      [courtesy cc of this posting mailed to cited author]
> > 
> > In comp.lang.perl.misc, 
> >     James Stewart <james@britlinks.co.uk> writes:
> > :Just wondering how to find the sum of all the elements of an array. A
> > :look through the FAQs doesn't yield an answer. I guess I could do it with
> > :a loop, but I'm guessing there's a more elegant solution.
> > 
> > A loop is inelegant?
> 
> not necessarily, but if there were a single command to do this I'd
> consider that more elegant.

there is - see the "builtin" module and the sum() function.  i even wrote
a Perl Journal article about it (issue 11, i think).  it's an order of 
magnitude faster than a loop.  and who thinks C isn't faster than Perl? ;)

you might have to pick up builtin.pm at CPAN.

-- 
brian d foy                    
CGI Meta FAQ <URL:http://www.smithrenaud.com/public/CGI_MetaFAQ.html>
Perl Monger Hats! <URL:http://www.pm.org/clothing.shtml>


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

Date: Tue, 22 Jun 1999 14:42:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Summing an array
Message-Id: <MPG.11d9a31b6505b1b9989c22@nntp.hpl.hp.com>

In article <376feb19@cs.colorado.edu> on 22 Jun 1999 13:59:21 -0700, Tom 
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc, 
>     James Stewart <james@britlinks.co.uk> writes:
> :Just wondering how to find the sum of all the elements of an array. A
> :look through the FAQs doesn't yield an answer. I guess I could do it with
> :a loop, but I'm guessing there's a more elegant solution.
> 
> A loop is inelegant?

Why didn't you tell him to use APL?

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Tue, 22 Jun 1999 15:01:42 -0700
From: TRG Software : Tim Greer <webmaster@chatbase.com>
To: Darrell Stec <darstec@aol.com>
Subject: Re: virtualave.net
Message-Id: <377007C6.D3E109CB@chatbase.com>

Darrell Stec wrote:
> 
> 
> Answered in Email.  Every time Timmy sees Virtual Avenue or free web host and a
> reply from me, he thinks I want his personal opinion in Email, NOT.
> 
> Later,
> Darrell Stec                               E-Mail: DarStec@aol.com
> 
> Webpage Sorcery
> http://webpagesorcery.com
> We Put the Magic in Your Webpages

And you're still nuts. Post a Perl question, or go away. Apparently
you'll never "get it", even if I explain it to DEATH. Why don't you just
run this NG then, as apparently you think your opinions should override
the basic beliefs of the entire ideals.
-- 
Regards,
Tim Greer   : webmaster@chatbase.com  | software@linkworm.com
The ChatBase: http://www.chatbase.com | 250,000+ hits daily Worldwide!
TRG Software: http://www.linkworm.com | CGI scripts in Perl/C, & more.
Unix/NT/Novell Administration, Security, Web Design, ASP, SQL, & more.
Freelance Programming & Consulting, Musician, Martial Arts, +Sciences.


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

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

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