[8539] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2156 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 22 09:18:08 1998

Date: Sun, 22 Mar 98 06:01:07 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Sun, 22 Mar 1998     Volume: 8 Number: 2156

Today's topics:
    Re: "Newbie" Crib Notes <stackhou@execpc.com>
        An offer to buy a script (A Watcher)
        Destroying objects and their memory? (Wade Williams)
        Directory Sort and List Question studio@ktb.net
        Directory Sort and List Question studio@ktb.net
    Re: Directory Sort and List Question <rra@stanford.edu>
        file editing <Louis.Shue@anu.edu.au>
    Re: file editing (A. Deckers)
    Re: for ($x,$y) ([0,0]..[5,5]) revisited <rjk@coos.dartmouth.edu>
    Re: how to know the version of the perl (Gabor)
    Re: html parser (Abigail)
    Re: inserted text <rjk@coos.dartmouth.edu>
    Re: inserted text (Gabor)
    Re: Is there a "Newsgroup" for Newbies to Perl? <stackhou@execpc.com>
        panic: leave_scope inconsistency <photo@tiac.net>
        Perl for Win32 {NT4.0 sp3} simple scripting probs... <troy.c@scsi-online.net>
    Re: PerlRing??? <stackhou@execpc.com>
        print inside of loop occurs outside of loop??? <justme@pobox.com>
    Re: ssh exit status from perl (Jason Gloudon)
    Re: ssh exit status from perl <webmaster@fccjmail.fccj.cc.fl.us>
        Windows DLL support for perl <josef_schiefer@mailcity.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 22 Mar 1998 06:26:10 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: "Newbie" Crib Notes
Message-Id: <6f3095$dqt@newsops.execpc.com>

Abigail,

My sincere apologies.  Below is a clip from a previous post,
Calling all "Newbies"  As far as I can tell, only one person
responded to this post.  Since I didn't get any objections,
I
assumed this would be acceptable to all.  Sorry, my error!
This was just my feeble attempt to help correct an obvious
source of irritation in this Usenet.  Looks like it's not
going to work.  I guess I'll just trash to whole idea. 
Again,
I apologize... I guarantee you'll not see a post of this
nature
from me in the future.  In this group you're Damned if you
do and
Damned if you don't!  I'm outa here!

--
Mark Stackhouse

***********************************************************************

homepage: http://www.execpc.com/~stackhou

"The best things in life aren't things."
--Art Buchwald

***********************************************************************

<clip from "Calling all Newbies">
All,

Since we seem to be the "Log Jamb" on this Usenet, maybe we
can do something to help ourselves and alleviate some of the
problem at the same time.

Every time I read a good post that has an exceptionally well
worded response, I cut and paste it into a text file that I
have named "Perl_notes".  Now I can query my notes with the
editor of my choice and possibly find the answer to my own
question!!  I tend to save things that I know I'll be
working on soon or think I'll need somewhere down the road. 
I've separated each entry with the same script as a
delimiter (I think that's the right term).  As the file
grows and is no longer manageable, I plan on writing a Perl
script to separate notes out into different files by
category.  The more I collect, the less likely I'll have to
dive into the FAQ or Perl docs.  If enough of us did
something similar, we could then periodically post our
"Newbie Crib Notes" for others to cut and paste from. 
Expert solutions without Expert involvement!

If enough "Newbies" take part in this exercise, we should be
able to reduce some of the traffic here.  Maybe the Experts
would gives us some
real great answers, especially if we inform them of the fact
we save all
posts in our "Newbie Crib Notes".  I'm not sure this will
work, but I know it will work for me.


Abigail wrote:


<snip>
> ++ Array element count:
> ++
> ++ ++ How can you get the length of an array that's an element
> ++ of another
> ++ ++ array?
> ++ ++
> ++ ++ For example, the naive approach doesn't work (prints
> ++ 581688):
> ++ ++
> ++ ++ #!/usr/local/bin/perl
> ++ ++
> ++ ++ @test = (["eggs","bacon","juice"],
> ++ ++       ["sandwiches","cheese"],
> ++ ++       ["tofu"],
> ++ ++       ["apple pie"]);
> ++ ++
> ++ ++ $length = @test[0];          # how many elements in the
> ++ first row?
> ++
> ++ Well, that's easy. All we need to do is get the array, and
> ++ evaluate
> ++ it in scalar context.
> ++
> ++ $test [0] is a ref to the first row.
> ++
> ++ Hence, @{$test [0]} is the first row.
> ++
> ++ Now we eval it in scalar context:
> ++
> ++ printf "%d\n", scalar @{$test [0]};
> ++
> ++
> ++ And that prints '3'.
> 
> WAIT A MINUTE!
> 
> *I* wrote that.
> 
> You can't just take someone's work, stuff it in a collection and pass
> it off as "your gift to newbies".
> 
> That is illegal.
> 
> You didn't even bother to mention you stole it somewhere, let alone
> from who.
> 
> I don't mind people quoting me, provided they use proper attributions
> *and* don't stuff it in a collection of abominable quality.
> 
> I want you to take my work out of your collection, and never, ever
> put anything by me in it again.
> 
> Abigail

Abigail wrote:
> 
> Mark Stackhouse (stackhou@execpc.com) wrote on MDCLXIII September
> MCMXCIII in <URL: news:6f11jq$57k@newsops.execpc.com>:
> ++ Please DO NOT post to this thread!  The information here has
> ++ been assembled
> ++ as a resource for beginning Perlers.  If you have comments,
> ++ flames, or an
> ++ excellent response to a beginners question, please reply to
> ++ "Sender Only".
> ++ I will do my best to add new information as I have time.  If
> ++ you feel you must
> ++ post to the group, could you please start a new thread i.e.
> ++ Re: Was Newbies
> ++ Crib Notes?  This thread should be allowed to expire.  Thank
> ++ you.
> 
> Well, you didn't set a 'Followup-To:' header....
> 
> Besides, I think I have the right to followup to my own postings (see
> the end of this posting) using whatever Subject I please.
> 
> ++ >I have tried the perl documentation but was not able to find any source
> ++ >for my following problem:
> ++ >I would like to remove everything between '<' and '>' in a line and for
> ++ >all the instances.  I am trying to work out a script that basically
> ++ >removes all the formatting tags in an HTML document.  For the script:
> ++
> ++ How about:
> ++
> ++  $line =~ s/<[^>]*>//g;
> ++
> ++ Note: The above example *will* run into problems if '<' or
> ++ '>' actually
> ++ appear
> ++ in the desired text (in the text they should be represented
> ++ as &lt; and &gt;
> ++ or
> ++ if each '<' is not properly matched with its corresponding
> ++ '>'.
> 
> Well, < *CAN* appear in valid html and not be the beginning of tag.
> Furtermore, > can appear inside a tag an *NOT* be the end.
> 
> If you really want to help newbies, please drag them to the FAQ where
> this is explained, and which gives way better algorithms than the
> above regex.
> 
> ++ What you want is
> ++   $line =~ s/<.+?>//g;
> ++
> ++ Look for the term "greedy" in the perlre manpage.
> 
> No you don't. What you want is HTML::Parser.
> 
> ++     try    $line =~ s/<.*?>//g;      -   the *? is a
> ++ non-greedy pattern
> ++ match ie it matches the shortest as opposed to the longest
> ++ pattern
> 
> ... and fail on a gazillion cases, including a newline inside a tag.
> 
> ++ Count occurrences in a string:
> ++
> ++     $string = "-9 55 48 -2 23 -76 4 14 -44";
> ++     while ($string =~ /-\d+/g) { $count++ }
> ++     print "There are $count negative numbers in the string";
> 
> Or just $count = () = /-\d+/g;
> 
> ++ while ($line = <IN>) {
> 
> That fails if the file ends with a lone 0
> 
> ++ "Send mail" solution:
> 
> use Mail::Send;
> 
> Don't teach newbies to pipe into sendmail. Please.
> 
> ++ my $var = 5;
> ++ print ("N plus one is ", $var + 1, "\n");
> ++
> ++ Try something like the following:
> ++
> ++         my $var = 5;
> ++         my $string  "N plus one is ($var + 1)\n";
> ++         $string =~ s/\((.*?)\)/eval $1 or '[error]'/ge;
> ++         print $string;
> ++
> ++ which should yield
> ++
> ++         N plus one is 6
> ++
> ++ That substitution line grabs everything in parentheses, and
> ++ replaces
> ++ it with its evaluated form. The 'e' modifier tells the
> ++ substitution
> ++ operator to use the replacement text as raw perl code. If
> ++ the eval
> ++ fails, an error message is used instead.
> 
> Of course, it would sadly fail on (($var + 2) * 3).
> 
> print "N plus two times three is ${\(($var + 2) * 3)}\n";
> 
> ++ Array element count:
> ++
> ++ ++ How can you get the length of an array that's an element
> ++ of another
> ++ ++ array?
> ++ ++
> ++ ++ For example, the naive approach doesn't work (prints
> ++ 581688):
> ++ ++
> ++ ++ #!/usr/local/bin/perl
> ++ ++
> ++ ++ @test = (["eggs","bacon","juice"],
> ++ ++       ["sandwiches","cheese"],
> ++ ++       ["tofu"],
> ++ ++       ["apple pie"]);
> ++ ++
> ++ ++ $length = @test[0];          # how many elements in the
> ++ first row?
> ++
> ++ Well, that's easy. All we need to do is get the array, and
> ++ evaluate
> ++ it in scalar context.
> ++
> ++ $test [0] is a ref to the first row.
> ++
> ++ Hence, @{$test [0]} is the first row.
> ++
> ++ Now we eval it in scalar context:
> ++
> ++ printf "%d\n", scalar @{$test [0]};
> ++
> ++
> ++ And that prints '3'.
> 
> WAIT A MINUTE!
> 
> *I* wrote that.
> 
> You can't just take someone's work, stuff it in a collection and pass
> it off as "your gift to newbies".
> 
> That is illegal.
> 
> You didn't even bother to mention you stole it somewhere, let alone
> from who.
> 
> I don't mind people quoting me, provided they use proper attributions
> *and* don't stuff it in a collection of abominable quality.
> 
> I want you to take my work out of your collection, and never, ever
> put anything by me in it again.
> 
> Abigail
> --
> perl -pwle '$_ .= reverse'

--
Mark Stackhouse

***********************************************************************

homepage: http://www.execpc.com/~stackhou

"The best things in life aren't things."
--Art Buchwald

***********************************************************************


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

Date: Sun, 22 Mar 1998 08:42:07 GMT
From: dodge@aloha.net (A Watcher)
Subject: An offer to buy a script
Message-Id: <3514c83d.24124763@news.aloha.net>

Hi,

I need a script that runs on a unix server that will function in the
major browsers (ver. 3.xx of Netscape and MS IE) that will reflect the
address,  date and time of a visitor to my site.  This utility to be
placed on several pages to   inform the visitor that the visit is
logged.   The script to be embedded into a perl 5 file that is already
running a shopping cart program and printing to the pages produced by
the existing script.  The output should also be printed to a log file
that I can access that is separate to my regular log file.  This log
file should be flexible where if deleted or damaged will self generate
as well as append new data.   The print to page to help deter
potential, problem transactions. 

Something like:

Welcome 206.173.225.180  
[21/Jan/1998:23:39:50 -0800] 
Your visit has been logged. 

If you have such a script running, give me the url to check it  out
and how much you want for it.  

You can check the running script at:

http://www.spiced.com/SPICED/JOS/KOI_MENU.HTML which is a demo page.

Please email your replies.  

Thank you so much.     

John
 The more I know, the more I know -- I don't know.

                    {:>)=  

            http://www.spiced.com        


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

Date: Sun, 22 Mar 1998 00:49:34 -0600
From: wwilliam@cisco.com (Wade Williams)
Subject: Destroying objects and their memory?
Message-Id: <wwilliam-2203980049340001@10.0.0.2>

I've got a program that makes heavy use of the GIFgraph.pm module.

However, there's a problem - at every invocation of the plot_to_gif
method, about 40K of memory is chewed up.  Since I'm invoking the method
500 times, I lose 20 megs of memory.

I only create the object once.  So, apparantly there's a bug in the
GIFgraph code which is not releasing memory. 

If I simply undef the object, will that destroy it and release any memory
it's using?  It doesn't seem to.

I've copied the author on this message, but my question to you is, what
does it take to destroy an object and the memory it's using?  Is it
guaranteed that if an object is destroyed, any of the memory it consumed
will be released?

Thanks,

Wade

-- 
 --------------------------------------------------------------------------
 Wade Williams                      Fly WarBirds! (Mac or PC)
 Systems Engineer, CCIE #3373          http://www.icigames.com/warbirds
 Cisco Systems, Inc.                        
 Brentwood, TN                      
 615-221-2918                              
 wwilliam@cisco.com    
 --------------------------------------------------------------------------


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

Date: Sun, 22 Mar 1998 03:02:08 -0600
From: studio@ktb.net
Subject: Directory Sort and List Question
Message-Id: <6f2k0p$6t5$1@nnrp2.dejanews.com>

I've picked up a number of handy snippets from this newsgroup that helped me
piece together the following chunks of code, but now I'm a bit stumped as to
how I can combine them.

First off, what I'm trying to do is produce an html file list, showing the
name of each file and creating a link to each file. Here's what I've
been using:

     {

opendir (MYDIR, "$dir") || die ("Can't get it.");
while ($list = readdir(MYDIR)) {
	if ($list =~ /html/)   {
	($cleanlist = $list) =~ s/\.html//g;
	($namelist = $cleanlist) =~ s/_/ /g;
				}
				{

	if ($list ne ".." && $list ne ".")

	{
	print "<tr><td width=100% valign=top><font face=arial,helvetica size=2
color=white><a href=\"$dir\/$list\" target=newpage>$namelist</a><br>\n";
	print "</td></tr>";
	}
  				}
		                }
closedir (MYDIR);
}

Now, I want to sort the files in reverse chronological order (newest file
first). I'm reading the files into an array, and using the Schwartzian
Transform, doing the sort with the following snippet of code:

opendir (MYDIR, "$dir") || die ("Can't get it.");
@files = readdir(MYDIR);
@sorted_by_date = map {$_->[0]} sort {$a->[1] <=> $b->[1]} map { [$_, -M] }
@files;


Question: How can I get @sorted_by_date to properly feed into the chunk of
code above? Simply using  $list = @sorted_by_date  gives me an output of the
number of files. I've found that $list = "@sorted_by_date" produces a single
string of all the file names combined in both the link and listing output. I'm
sure it's something simple. Maybe a split statement?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Sun, 22 Mar 1998 03:02:08 -0600
From: studio@ktb.net
Subject: Directory Sort and List Question
Message-Id: <6f2juv$ln5$1@nnrp1.dejanews.com>

I've picked up a number of handy snippets from this newsgroup that helped me
piece together the following chunks of code, but now I'm a bit stumped as to
how I can combine them.

First off, what I'm trying to do is produce an html file list, showing the
name of each file and creating a link to each file. Here's what I've
been using:

     {

opendir (MYDIR, "$dir") || die ("Can't get it.");
while ($list = readdir(MYDIR)) {
	if ($list =~ /html/)   {
	($cleanlist = $list) =~ s/\.html//g;
	($namelist = $cleanlist) =~ s/_/ /g;
				}
				{

	if ($list ne ".." && $list ne ".")

	{
	print "<tr><td width=100% valign=top><font face=arial,helvetica size=2
color=white><a href=\"$dir\/$list\" target=newpage>$namelist</a><br>\n";
	print "</td></tr>";
	}
  				}
		                }
closedir (MYDIR);
}

Now, I want to sort the files in reverse chronological order (newest file
first). I'm reading the files into an array, and using the Schwartzian
Transform, doing the sort with the following snippet of code:

opendir (MYDIR, "$dir") || die ("Can't get it.");
@files = readdir(MYDIR);
@sorted_by_date = map {$_->[0]} sort {$a->[1] <=> $b->[1]} map { [$_, -M] }
@files;


Question: How can I get @sorted_by_date to properly feed into the chunk of
code above? Simply using  $list = @sorted_by_date  gives me an output of the
number of files. I've found that $list = "@sorted_by_date" produces a single
string of all the file names combined in both the link and listing output. I'm
sure it's something simple. Maybe a split statement?

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: 22 Mar 1998 01:37:53 -0800
From: Russ Allbery <rra@stanford.edu>
To: studio@ktb.net
Subject: Re: Directory Sort and List Question
Message-Id: <m3lnu3vzf2.fsf@windlord.Stanford.EDU>

[ Posted and mailed. ]

studio <studio@ktb.net> writes:

> opendir (MYDIR, "$dir") || die ("Can't get it.");
> while ($list = readdir(MYDIR)) {

[...]

> Question: How can I get @sorted_by_date to properly feed into the chunk
> of code above?

        for $list (@sorted_by_date) {

will iterate through the array, aliasing $list to each element in turn.  A
very useful code construct, *more* useful on the whole in my experience
than while loops.  I use for loops more.  :)

BTW, your coding style is difficult for me to read due to how you indent
braces.  Dunno if that matters much or not, but you may want to consider
getting used to a more standard indentation.

-- 
#!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
$^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print


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

Date: Sun, 22 Mar 1998 23:50:32 -0800
From: Louis Shue <Louis.Shue@anu.edu.au>
Subject: file editing
Message-Id: <35161448.3827FE3A@anu.edu.au>

Hi all,

I have just started to use Perl 5.0 on my Linux box, so please excuse me
if this is a trivial question. I was wondering if someone can tell me
how to write a script to edit a text file (note: to INSERTT additional
lines rather than REWRITE the entire file)? Or at least point me to
sites where I may find some pre-made scripts? The files I have in mind
all have the same structure, some common info at the start, then a sort
of a table, and this is where I need to insert new information
periodically.

Thanks in advance.

Regards,

Louis.



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

Date: 22 Mar 1998 13:01:46 GMT
From: Alain.Deckers@man.ac.uk (A. Deckers)
Subject: Re: file editing
Message-Id: <slrn6ha2tq.dst.Alain.Deckers@bashful.rediris.es>

In <35161448.3827FE3A@anu.edu.au>,
	Louis Shue <Louis.Shue@anu.edu.au> wrote:
>Hi all,
>
>I have just started to use Perl 5.0 on my Linux box, so please excuse me
>if this is a trivial question. I was wondering if someone can tell me
>how to write a script to edit a text file (note: to INSERTT additional
>lines rather than REWRITE the entire file)? Or at least point me to
>sites where I may find some pre-made scripts?

ftp://ftp.oleane.net/pub/mirrors/CPAN/doc/manual/html/pod/perlfaq5/How_do_I_change_one_line_in_a_fi.html

Alain
-- 
Perl reference: <URL:http://reference.perl.com/>
 Perl language: <URL:http://language.perl.com/>
  Perl archive: <URL:http://www.perl.com/CPAN/>
      Perl FAQ: <URL:http://www.perl.com/CPAN/doc/FAQs/FAQ/>


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

Date: Sun, 22 Mar 1998 00:36:14 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: "Je ne care pas!" <jefpin@bergen.org>
Subject: Re: for ($x,$y) ([0,0]..[5,5]) revisited
Message-Id: <3514A34F.7E448D60@coos.dartmouth.edu>

[posted and mailed]

Je ne care pas! wrote:
> 
>                 my ${"a$tmp"} = $vars->[$tmp];

You can't use my() with symbolic variable names.  Symbolic references only
work with variables in the symbol table.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 22 Mar 1998 13:22:14 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: how to know the version of the perl
Message-Id: <slrn6ha4tm.otj.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Abigail <abigail@fnx.com> wrote :
# Gabor (gabor@vmunix.com) wrote on MDCLXIII September MCMXCIII in
# ++ That will give the message
# ++ 'Illegal varibale name'
# ++ 
# ++ You forgot to backslash the $, to keep it from being interpreted by
# ++ the shell.
# 
# You need a better shell. My shell doesn't complain.
# 
# $ $SHELL --version
# GNU bash, version 2.01.0(1)-release (sparc-sun-solaris2.5.1)
# Copyright 1996 Free Software Foundation, Inc.
# $
# 
# And for that matter, it works in the Bourne shell as well, as well
# as in ksh. 

Ok, I should've said that it doesn't work in all shells.
Backslashing it does.


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

Date: 22 Mar 1998 08:40:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: html parser
Message-Id: <6f2iqp$gan$2@client3.news.psi.net>

Rouslan Zenetl (rouslan@erols.com) wrote on MDCLXIV September MCMXCIII in
<URL: news:351484A9.5B266CA3@erols.com>:
++ is there a perl-based html parser? or should i rather start looking
++ towards python?


use HTML::Parser;



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Sun, 22 Mar 1998 00:43:55 -0500
From: Ronald J Kimball <rjk@coos.dartmouth.edu>
To: Milos Prudek <prudek@sol.cz>
Subject: Re: inserted text
Message-Id: <3514A51D.7089B06A@coos.dartmouth.edu>

[posted and mailed]

Milos Prudek wrote:
> 
> The following is taken from a simple phonebook script. I do not
> understand the print <<"HTML"; command. I looked into Larry Walls
> "Programming in Perl" but it does not seem to be there. What am I
> missing?

That one is hard to find if you don't know what it's called.

"Here documents", page 43, Programming Perl, 2nd Ed.

-- 
 _ / '  _      /         - aka -             rjk@coos.dartmouth.edu
( /)//)//)(//)/(    Ronald J. Kimball           chipmunk@m-net.arbornet.org
    /                                   http://www.ziplink.net/~rjk/
        "It's funny 'cause it's true ... and vice versa."


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

Date: 22 Mar 1998 13:16:34 GMT
From: gabor@vmunix.com (Gabor)
Subject: Re: inserted text
Message-Id: <slrn6ha4j2.otj.gabor@vnode.vmunix.com>

In comp.lang.perl.misc, Milos Prudek <prudek@sol.cz> wrote :
# The following is taken from a simple phonebook script. I do not
# understand the print <<"HTML"; command. I looked into Larry Walls
# "Programming in Perl" but it does not seem to be there. What am I
# missing?

You couldn't have looked hard because it's on page 43.


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

Date: Sun, 22 Mar 1998 07:43:17 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <6f34pt$b0a@newsops.execpc.com>

James,

I agree with you 100%... but, your thinking here is
idealistic.  Please
take a minute and look at this problem from the side of
realism:

Management, all across this great country of ours, in their
infinite   wisdom, has decided that "Down Sizing" is the way
to improve bottom
line.  The corporation I work for has eliminated nearly half
of our
professional programmers and totally eliminated our software
training
staff.  We now must resort to satellite transmissions and
video tape to
learn software applications.  Engineering is expected to
shoulder the
responsibilities previously assigned to the Software Support
Group.  No
new requests are being accepted.

I am not a programmer, but I'm still expected to get the job
done.  In
a UNIX environment, AWK, SED, and GREP, don't quite get the
job done.
Perl, was recommended as the language of choice to fill the
gap between
scripting and "C".  I've taken a 16 week night course in "C"
but unless
one uses this language continuously, the necessary syntax
begins to fade.  Perl was a God send for me.  I can actually
get some real work done in a relatively short period of
time.  Certainly quicker than if I
attempt struggling with "C".

If you, (or anyone else for that matter), knows of a better
language that non programmers can utilize to get some REAL
work done, I'm all ears!  I've only invested a few weeks
into Perl so it would be no big loss on my part.  Twenty
bucks for another book to gather dust on "ye
ole book shelf" is no big deal.  Maybe there's an
opportunity for someone to make some big bucks here?

The dike has broken.  The inrush of Newbies is only just
beginning.  This Usenet is going to be flooded with "How do
I set up an array in Perl?" at an ever increasing rate
(maybe exponentially).  If folks around here don't like
that, you can start flaming Corporate America.

I was recently "flamed to toast" for trying to do my small
part in elevating the "Newbie" problem (see Newbie Crib
Notes).  I give up,
this will probably be my last post to the group.  I'll
continue reading, in the attempt to learn what I can between
now and next fall.  By then I should be able to get my butt
into a night class.

BTW, if there are any "Experts" here who wouldn't mind
answering a few questions now and then, please reply to
"Sender Only".  I'll add you to my address book.

Another Newbie bites the dust.

Regards,
--
Mark Stackhouse

***********************************************************************

homepage: http://www.execpc.com/~stackhou

"The best things in life aren't things."
--Art Buchwald

***********************************************************************


I R A Aggie wrote:
> 
> In article <6f1neb$710$1@srv38s4u.cas.org>, lvirden@cas.org wrote:
> 
> + Certainly Perl's module concept is good first steps towards this type of
> + user.  But if someone has to get compilers, books, pages of FAQs,
> + man pages, internet connections and web browsers (to search online
> + archives and web pages) and seemingly then to learn to program in one
> + language and THEN to learn perl, before being able in many cases to ask
> + for help would seem to be a pretty steep intro curve for the appliance
> + user.
> 
> Do appliance users in the Real World go to Radio Shack, buy components,
> and put together a 4 head VHS tape recorder?
> 
> No. Why should they expect to be able to walk in, slap together a
> couple of subroutines and a main program, and a functioning CGI script?
> These are the same people who complain that setting the said VCR's
> clock is hard. Do you want them modifying CGI scripts and putting
> them on YOUR server?
> 
> James
> 
> --
> Consulting Minister for Consultants, DNRC
> The Bill of Rights is paid in Responsibilities - Jean McGuire
> To cure your perl CGI problems, please look at:
> <url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sun, 22 Mar 1998 02:47:40 -0500
From: Daniel Lipton <photo@tiac.net>
Subject: panic: leave_scope inconsistency
Message-Id: <Pine.BSF.3.95q.980322022202.11952A-100000@shell1.tiac.net>

Somehow I have managed to write a program that consistantly core dumps.
Not knowing enough of the perl internals to make sense of the gdb output,
I tried trapping signals to see if I could get any more information.

I got the following error trapping SEGV:

panic: leave_scope inconsisency at line 130.

line 130 closes a filehandle.  

Is this in relation to trapping SEGV or does this point to something else.
As well, I am uncertain even what the error means even though I have read
the definition of the error in perldiag.1.

Thank you,

Daniel





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

Date: Sun, 22 Mar 1998 14:59:08 +0900
From: "Troy Coulombe" <troy.c@scsi-online.net>
Subject: Perl for Win32 {NT4.0 sp3} simple scripting probs...
Message-Id: <6f28t7$6ss$1@news.yokota.attnet.or.jp>

REF: Learning Perl page 87 -->  $sentence=~/$what/

Having RTF[M,FAQ]

I realize that PERL is native to UNIX, and I am not
using UNIX but
NT4.0 SP3 & a precompiled version of PERL... .
The script runs {ie: no syntax error] but I can not get
my hack
[listed below] or the example in the book to work
correctly

$OPTION=qw(0 1 2 3 4);
do

   print "0 : Quit \n";
   print "1 : $CHOICE1\n";
  chomp ($CHOICE=<stdin>); }
until ($OPTION =~ /$CHOICE/);


Neither my hack, nor the book's hack seems to work...
What did I miss?  Don't mind doing the reading, just
haven't been able to find anything about this...

Basically: how do I compare a scalar to an entire list?
TIA

--
Troy C
Please remove the dot from between the troy and the c
when replying!





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

Date: Sat, 21 Mar 1998 19:06:59 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Re: PerlRing???
Message-Id: <6f1ofg$qca@newsops.execpc.com>

Joergen,

I'm sure I tried that search tool once before but I went to
perl.com and
tried it again.  I searched on the following words: array,
@array, scalar, $scalar and split.  I was disappointed the
first time, and I'm still disappointed.  The next time your
there, try it yourself and see what you think.

--
Mark Stackhouse

***********************************************************************

homepage: http://www.execpc.com/~stackhou

"The best things in life aren't things."
--Art Buchwald

***********************************************************************


Joergen W. Lang wrote:

<snip>

> As far as I know, such a thing exists right at the www.perl.com
> startpage, just scroll down a little. It's on the left hand side
> together with a lot of predefined keywords.
> 
<snip>

> Joergen
> --
> -------------------------------------------------------------------
>    "Everything is possible - even sometimes the impossible"
>              HOELDERLIN EXPRESS - "Touch the void"
> -------------------------------------------------------------------


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

Date: Sun, 22 Mar 1998 06:49:05 +0000
From: Aaron Turner <justme@pobox.com>
Subject: print inside of loop occurs outside of loop???
Message-Id: <3514B461.40AFB975@pobox.com>

I've got a really wierd thing going on.  I've got a loop that scans a
log file and at the end of the loop it increments a counter. Every X
executions of the loop, it prints out the counter.  Ie, if X=10:

10-20-30-40-50-60-...

Problem is that the above line prints AFTER the loop has completed all
it's iterations which negates the whole point.  Here's the code:


sub scan_folders { 
$SIZE_TOTAL=0;
$NEW_TOTAL=0;
$INDICATOR=10;
$LAST_INDICATOR=0;
my ($i, $LOG_LINES, @SIZE, $SIZE);
# Note: @LOG defined in scan_log()
SCAN: for ($LOG_LINES=@LOG; $LOG_LINES >=0 ; $LOG_LINES --) {
# the $MAILBOXES[0]-1 in the next line skips "Unkown_Mailbox"
	for ($i = 1; $i <= $MAILBOXES[0]-1; $i++) {
# if a new email...
	  if ($LOG[$LOG_LINES] =~ /$MAILBOXES[$i]/) { 
# increment counter for that mailbox
	    $FOLDER_CNT{$MAILBOXES[$i]} ++;
# the 3rd column is the size of the email
	    @SIZE = split (/\s+/, $LOG[$LOG_LINES]);			
	    $SIZE = $SIZE[3];
# Add the size of this email to the size of this folder
	    $FOLDER_SIZE{$MAILBOXES[$i]} += $SIZE;
# Add the size of this email to the size of all emails logged
	    $SIZE_TOTAL += $SIZE;
# One more email
	    $NEW_TOTAL ++;
# print out ${NEW_TOTAL}- every $INDICATOR th new email if indicator not
turned off
# and $INDICATOR != 0
	    (($INDICATOR != 0) && ($NEW_TOTAL % $INDICATOR == 0) &&
($INDICATOR_OFF == 0)) &&
	          print "${NEW_TOTAL}-";
# if a match, skip to the next line
	    next SCAN;
	  }
	}
# Some other code here to take care of non-matches...
}
}


If anyone has any ideas, please let me know!

-Aaron Turner


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

Date: Sun, 22 Mar 1998 05:26:48 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: ssh exit status from perl
Message-Id: <slrn6h9867.4gi.jgloudon@manitoba.bbn.com>

Pat Trainor <ptrainor@bbnplanet.com> wrote:
>
>	How can:
>
>$idremote = `ssh -l $ssh_user[$server_number] \
> $ssh_server[$server_number] /usr/bin/egrep '^$login:' /etc/passwd`;          
>
>	the scalar $idremote be used/evaluated to determine if the ssh
>session returned an exit status of 0 or 1 ?? STDIN appears to be terminal
>only, so I can't batch (nor want to) the password.

You might want to use system() instead of backquotes, which returns
the exit status of the command * 256. `perldoc -f system`.

-- 
Jason Gloudon


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

Date: Sun, 22 Mar 1998 13:06:30 GMT
From: Webmaster <webmaster@fccjmail.fccj.cc.fl.us>
Subject: Re: ssh exit status from perl
Message-Id: <35150B7B.3C9D1EFA@fccjmail.fccj.cc.fl.us>

Jason Gloudon wrote:

> You might want to use system() instead of backquotes, which returns
> the exit status of the command * 256. `perldoc -f system`.
>
> --
> Jason Gloudon

  How about making that -

    $erc = system("ls -l") / 256 unless $erc;

HTH,
Sneex :-)



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

Date: Sun, 22 Mar 1998 13:33:21 +0100
From: Josef Schiefer <josef_schiefer@mailcity.com>
Subject: Windows DLL support for perl
Message-Id: <35150511.9594A78E@mailcity.com>

Hi,

I am looking for a possibility to call via perl functions from a Windows
DLL. Has somebody an idee to do that in a simple and easy
way?

Best regards
Josef 
 
_______________________________________________
                     ,    ,
                    ("\''/").___..--''"`-._
                      9_ 9  )   `-.  (     ).`-.__.`)
     Josef Schiefer  (_Y_.)'  ._   )  `._ `. ``-..-'
                   _..`--'_..-_/  /--'_.' .
                  (il).-''  ((i).'  ((!.-'
_______________________________________________
      eMail: josef_schiefer@mailcity.com


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

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

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