[8828] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2445 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 28 17:07:41 1998

Date: Tue, 28 Apr 98 14:00:27 -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, 28 Apr 1998     Volume: 8 Number: 2445

Today's topics:
    Re: 'each' and recursion, do they mix? <jll@skynet.be>
    Re: 'each' and recursion, do they mix? <jll@skynet.be>
        (offtopic) Re: ANNOUNCE: Perl Builder IDE Now Available (Brian Wheeler)
    Re: a way to remove files? <chad@NOSPAMumr.edu>
    Re: ANNOUNCE: Perl Builder IDE Now Available <grinch@whoville.com>
    Re: CGI script can't read from a disk file! otis@POPULUS.net
        cgi.pm usage <vdsilva@lucent.com>
    Re: cgi.pm usage <rootbeer@teleport.com>
    Re: Getting the filehandle from a typeglob <tchrist@mox.perl.com>
    Re: How to load the module with calculated name? <rootbeer@teleport.com>
    Re: Not crying when dying? <rootbeer@teleport.com>
    Re: Odd Regexp Question (Hunter Johnson)
    Re: Parsing HTML ... (Zeus Paleologos)
        Perl and sendmail consultant in Denver, CO area <mark_ahrens@hp.com>
    Re: Perl Editor?? <tchrist@mox.perl.com>
        Please suggest: perlfaq4 example does not work <rpandey@geocities.com>
    Re: rename funciton (was: Re: Dummie question) <rootbeer@teleport.com>
    Re: rename funciton (was: Re: Dummie question) <tchrist@mox.perl.com>
    Re: test post <sowmaster@juicepigs.com>
        uninitiated value warning... why? (Agent Hall)
    Re: unrecognizable switch <rootbeer@teleport.com>
    Re: using perl as a script <terjekv@ifi.uio.no>
    Re: warnings and Getopt::Std <David.Boyce@fmr.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 28 Apr 1998 22:22:36 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <VA.00000041.00d3d865@enterprise>

Correction:

>     struct hash
>     {
>         [...]
>         sub put_at(key, val)
>         {
>             die if iter.localized_depth && !iter.exhausted();
                                         ^^^^^^^^^^^^^^^^^^^^^
>             // like before
>         }
>     }

More reasons why this would be a good thing:

1) The new feature couldn't possibly hurt existing programs: local each %h     
was not allowed.
    
2) Perl could diagnose interweaved iteration & modification under -w (this 
would break some existing programs).
    
3) If (2) is a bit too harsh, forget it; the programmer could still localize 
the hash to get instant diagnostic on interweaved iter/modif diagnostics.

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/



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

Date: Tue, 28 Apr 1998 22:22:37 +0200
From: Jean-Louis Leroy <jll@skynet.be>
Subject: Re: 'each' and recursion, do they mix?
Message-Id: <VA.00000042.00d3ddb7@enterprise>

It looks like we're discussing 'problems' that were not that important 
in earlier 'script-oriented' versions of Perl, but which are more 
annoying in 'general-purpose', 'object-oriented' Perl5...

 ..and it all boils down to this: global variables are bad.

Jean-Louis Leroy
http://ourworld.compuserve.com/homepages/jl_leroy/



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

Date: 28 Apr 1998 20:19:38 GMT
From: bdwheele@indiana.edu (Brian Wheeler)
Subject: (offtopic) Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5dkq$6gn$1@jetsam.uits.indiana.edu>

In article <6i5bnj$f18@fridge.shore.net>,
	"Grinch" <grinch@whoville.com> writes:

> Tool tips, btw, are the little text messages that, in many apps, appear when
> you "hover" the mouse pointer for a second or two. Apple, as usual, insists
> on being different and calls them "Balloon Help." In this case, they display
> the value of the variable over which the pointer is hovering.

	I thought the mac had them first, so they didn't insist anything...
and they did look like little balloons...

Brian Wheeler
bdwheele@indiana.edu


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

Date: Tue, 28 Apr 1998 19:36:24 GMT
From: "Chad Peterson" <chad@NOSPAMumr.edu>
Subject: Re: a way to remove files?
Message-Id: <01bd72dc$ea61ee20$86a72682@P1207393.MDC.COM>

Try unlink(FILEHANDLE)

 -- I'm positive it's documented in many places.

shane michael harwood <sharwood@cs.uiowa.edu> wrote in article
<3546203F.41C6@cs.uiowa.edu>...
> hello,
> is there a way from within a perl script to remove files?
> 


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

Date: Tue, 28 Apr 1998 16:02:40 -0400
From: "Grinch" <grinch@whoville.com>
Subject: Re: ANNOUNCE: Perl Builder IDE Now Available
Message-Id: <6i5bnj$f18@fridge.shore.net>

Tom Phoenix wrote in message ...

>Of course, there's no way to always get the colors correct unless you have
>an error-proof way of parsing Perl - which no one has yet invented. :-)

Oh, I dunno... I heard about some guy who wrote a pretty good parser. His
name was Larry something or other... :-)

Seriously, though. Color syntax highlighting is maybe too stong a term to
use. The editor highlights keywords, comments, and quoted strings, that's
all. It doesn't take much to do that. The visual cues make it a little
easier to look at, though, especially after ten hour session of staring at a
monitor.

>>   breakpoints, single step, watches,
>>   and "tool tip" variable inspection.
>
>I don't know what that last is, but you can do all those others through
>the Perl debugger already.

Well, yes, but it's rodent-challenged and gui-deficient. Believe it or not,
that matters a LOT to some folks. To be honest, I actually don't think much
of the PB debugger; breakpoints, single- and back-stepping, and watches are
about all it can do. I think of it as a nice editor with a few basic
debugging hooks thrown in for good measure.

Tool tips, btw, are the little text messages that, in many apps, appear when
you "hover" the mouse pointer for a second or two. Apple, as usual, insists
on being different and calls them "Balloon Help." In this case, they display
the value of the variable over which the pointer is hovering.


IMHO, Perl Builder's best feature is one that isn't even listed. It allows
editor macros to be written in Perl!

-grinch

--
-----
"Yes, I'm paranoid, but that doesn't mean
no one's out to get me." - me

Sherm Pendley
grinch@whoville.com
http://www.whoville.com





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

Date: Tue, 28 Apr 1998 15:32:52 -0600
From: otis@POPULUS.net
Subject: Re: CGI script can't read from a disk file!
Message-Id: <6i5edk$cse$1@nnrp1.dejanews.com>

check your permissions more closely.
Try setting everything you can think of to 777 :)
and then slowly tightening up everything you can.

Otis

In article <35452C83.4CB8DA3@starnetusa.com>#1/1,
  Jason <jgirard@starnetusa.com> wrote:
>
> This is a problem I can't figure out for the life of me!
>
> In a directory /www/files I have the file "count" with permissions 666.
> In /www/cgi-bin is the script counter.cgi with permissions 755 which is
> supposed to open the file "count" and grab its contents.
> In Apache, I have directory access set to "allow from all" for both
> directories.  ExecCGI is set for /www/cgi-bin.  Apache is running as
> Nobody, -1
>
> With Apache running, I call the script from Netscape and get the
> following:
> "can't open file for reading! You are person  to visit this page."
>
> However, when I run in off-line mode, I get the correct result:
> <html><head><title>Counter test</title></head><body bgcolor="white">You
> are person
> <img src="http://me.this.domain/files/1.gif"><img
> src="http://me.this.domain/files/5.gif">
> <img src="http://me.this.domain/files/1.gif"> to visit this
> page.</BODY></HTML>
>
> The line of code in question is:
> open(COUNT_FILE,"/www/files/count") || print " can't open file for
> reading! ";
>
> Other CGI scripts that don't open files seem to work just fine.
>
> Did I configure something wrong with CGI or with Apache?
>
> Thanks in advance,
> Jason
>


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


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

Date: Tue, 28 Apr 1998 16:11:32 -0400
From: Victor D'Silva <vdsilva@lucent.com>
Subject: cgi.pm usage
Message-Id: <35463747.31F8@lucent.com>

Hello 

    I am using the Perl5(5.004) cgi.pm module to parse the input to the
cgi scipt on the server from an applet (POST Mechanism)

the query string generated is 

  old=str1&new=str2&renew=str3

I am using the command 
$query = new CGI
$old = $query->param('old') and so on

However the query string gets properly extracted when i  test my code 
from an appletviewer.The same code seems to initialise the 
query object, but does not initialize the variable old

Also when i try the script without cgi.pm but through the
STDIN , i get the whole string. So i guess the browser and the server
interact properly as expected, but the cgi.pm seems to behave difffernt.

Any help will be greatly appreciated

Thanks
Victor Dsilva


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

Date: Tue, 28 Apr 1998 20:34:21 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Victor D'Silva <vdsilva@lucent.com>
Subject: Re: cgi.pm usage
Message-Id: <Pine.GSO.3.96.980428133124.15049s-100000@user2.teleport.com>

On Tue, 28 Apr 1998, Victor D'Silva wrote:

> $query = new CGI
> $old = $query->param('old') and so on

There's the problem: You don't have a semicolon between lines, and your
second line has "so on" after it. :-)  

If you need help debugging your code, it doesn't help much to post fake
code! Cut your real code down to just a few lines which aren't doing what
you want, then post those here. Thanks!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 1998 20:19:54 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting the filehandle from a typeglob
Message-Id: <6i5dla$jtg$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    "yary h." <fecund@fatnet.net> writes:
:Thanks for taking a look-- I'm getting confused.

What's this autoflush business?  You are confused because you are trying
to use a glob as an object.  You can't do that.

BTW, did you know that it takes about 3700 lines of Perl source
and seventeen files just to say:

    use FileHandle;
    $fh_obj = FileHandle->new();

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    X-Windows: Flawed beyond belief.
	--Jamie Zawinski


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

Date: Tue, 28 Apr 1998 20:06:27 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Petr Prikryl <prikryl@dcse.fee.vutbr.cz>
Subject: Re: How to load the module with calculated name?
Message-Id: <Pine.GSO.3.96.980428130336.15049l-100000@user2.teleport.com>

On 28 Apr 1998, Petr Prikryl wrote:

>     eval "use lib '$dir';" or die "Unsuccessful use lib '$dir': $@";

To see whether an eval failed, check $@ directly, like this. (The return
value from an eval may be false even though the eval succeeds.) 

    eval "use lib '$dir';" ;
    die "Unsuccessful use lib '$dir': $@" if $@;

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Tue, 28 Apr 1998 20:17:28 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Petr Prikryl <prikryl@dcse.fee.vutbr.cz>
Subject: Re: Not crying when dying?
Message-Id: <Pine.GSO.3.96.980428131611.15049o-100000@user2.teleport.com>

On 28 Apr 1998, Petr Prikryl wrote:

> When trying to use the module which name and path were calculated
> during run-time, I have observed strange behaviour -- "die" command
> did not write anything -- died silently. Why?

You called it from within an eval. Do the docs for eval explain what
you're seeing? Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 1998 20:50:22 GMT
From: jhunterj@lexis-nexis.com (Hunter Johnson)
Subject: Re: Odd Regexp Question
Message-Id: <6i5fee$4b1@mailgate.lexis-nexis.com>

In article <82E778210F2134E4.2D55884FF8E43598.17BACF09A2DD9CCD@library-proxy.airnews.net>,
Derek Balling  <dballing@speedchoice.com> wrote:

> OK, I'm parsing a message which will contain two different strings
> "123456-12" and "987654" (actual numbers will vary, of course).

> ($number_1) = /(\d{6}\-\d{2})/
> ($number_2) = /(\d{6})[^\-]/

> this won't detect $number_2 if it appears at the very end of the
> string.  You're looking for 123456 There is no non-"-" character
> afterward, so it fails.

> Any thoughts on how to achieve this? Can I do something
> like:

> ($number_2) = /(\d{6})([^\-]|$)/  

> telling it to match 6 digits next to either a non-"-" or the end of
> the string? I didn't think that would work, but I'm open to
> suggestions.

Well, it wouldn't've hurt to try it, right? :-)

Yes, I think that that would work.  This might be "better", for some
senses of the word better:

($number_2) = /(\d{6})(?!-)/;

The (?!regexp) construction is a zero-width negative lookahead
assertion.  Check out the perlre man page for full details.

As an aside, the hyphen does not need to be escaped in you
construction:

($number_2) = /(\d{6})([^-]|$)/;

since the hyphen isn't special if it's the first thing in a class (and
the carat doesn't count).

HTH,
Hunter
--
J. Hunter Johnson        | "A little consistent wholesome modeling and
jhunterj@lexis-nexis.com |   costly servanthood are worth millions of
(937) 865-6800 x5385     |    true words harshly spoken."
Lexis-Nexis, Dayton, OH  |                               -- Ron Sider


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

Date: Tue, 28 Apr 1998 20:41:49 GMT
From: rl3s@netcom.com (Zeus Paleologos)
Subject: Re: Parsing HTML ...
Message-Id: <rl3sEs55Hp.7GA@netcom.com>

In article <6i26rf$72h$4@client3.news.psi.net> on 27 Apr 1998 15:05:19 GMT,
 Abigail (abigail@fnx.com) wrote:
> Anas Mughal (anas@erols.com) wrote on MDCXCIX September MCMXCIII in
> <URL: news:6i06fb$map$1@winter.news.erols.com>:
> ++
> ++ Does anyone has a script to parse HTML?

> Are you sure you would be able to use it? It might be too complicated.
> After all, locating it on CPAN seems to be a task already too complicated
> for you.

 ... while showing respect for one asking a question seems to be a tone
too complicated for some to master in framing their replies.

--
 "Too often a high intelligence squanders itself in a low regard for others."



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

Date: Tue, 28 Apr 1998 14:22:54 -0600
From: "Mark Ahrens" <mark_ahrens@hp.com>
Subject: Perl and sendmail consultant in Denver, CO area
Message-Id: <6i5dq1$6tv@hpuerci.atl.hp.com>

I'm looking for someone who can provide consulting on an as-needed basis in
the Denver, CO area.

All interested parties may email me at mark_ahrens@hp.com

Mark Ahrens
303-662-4859




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

Date: 28 Apr 1998 20:25:40 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Perl Editor??
Message-Id: <6i5e04$jtg$3@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Ala Qumsieh <aqumsieh@matrox.com> writes:
:Does anybody know of any good Perl editors on unix platform? 

vi; specifically, nvi.

--tom

#!/bin/sh
# This is a shell archive (produced by GNU sharutils 4.2).
# To extract the files from this archive, save it to some FILE, remove
# everything before the `!/bin/sh' line above, then type `sh FILE'.
#
# Made on 1998-04-28 14:25 MDT by <tchrist@jhereg.perl.com>.
# Source directory was `/home/tchrist'.
#
# Existing files will *not* be overwritten unless `-c' is specified.
# This format requires very little intelligence at unshar time.
# "if test", "echo", "mkdir", and "sed" may be needed.
#
# This shar contains:
# length mode       name
# ------ ---------- ------------------------------------------
#   5925 -rw-r--r-- .nexrc
#
echo=echo
if mkdir _sh30974; then
  $echo 'x -' 'creating lock directory'
else
  $echo 'failed to create lock directory'
  exit 1
fi
# ============= .nexrc ==============
if test -f '.nexrc' && test "$first_param" != -c; then
  $echo 'x -' SKIPPING '.nexrc' '(file already exists)'
else
shar: Saving .nexrc (text)
  $echo 'x -' extracting '.nexrc' '(text)'
  sed 's/^X//' << 'SHAR_EOF' > '.nexrc' &&
X"map = :s/$/ $/$r 74|F s
$xx0
X"set number
Xset ruler
Xset notimeout
X"
Xset sections=bpAfSeAhBhChRSRERh
Xset paragraph=PsPeXXFSFELsLeLiFEFSILIpplpipspBhChPLPPPQPP\ 
Xset extended showmode
X"	for better regexps
X"
Xset altwerase
Xset filec=\	
Xset cedit=\	
X"
Xset terse
X"	because we prefer terse error messages,
Xset writeany autowrite
X"	because we want to write out our file whenever we can,
X"	like on a :tag, :stop, or :next
Xset tabstop=8 
X"	so tabs look right for us 
Xset shiftwidth=4
X"	so ^T and << are smaller 
Xset report=1
X"	so we our told whenever we affect more than 1 line 
X"set nomesg
X"	because being talked to during an edit is aggravating
Xset autoindent
X"	so i don't have to tab in 
Xset redraw 
X"
Xset tildeop
X"optimize
X"	keep the screen tidy
X"
X"
X"	INPUT MACROS that i always want active
X"
Xmap!  :stop
X"	so i can stop in input mode.  note that autowrite is set, so 
X"map!  :stop!
X"	will stop me without writing.
X"	commented out cause causes bug 
X"
Xmap!  O
X"	lets me do kindof a negative carriage return in input mode.
Xmap!  bi
X"	non-destructive ^W
Xmap!  Ea
X"	and its inverse
X"
X"	ARROW MACROS next four let arrows keys work in insert mode; 
Xmap! OA ka
Xmap! OB ja
Xmap! OC lli
Xmap! OD i
X"
X" 	Who says you can't emulate emacs in vi? :-)
X"
Xmap!  i
Xmap!  lli
Xmap!  I
Xmap!  A
X"
X"
X"	EXCHANGE MACROS -- for exchanging things
X"
Xmap v xp
X"	exchange current char with next one in edit mode
Xmap V :m+1
X"	exchange current line with next one in edit mode
Xmap!  hxpa
X"	exchange last typed char with penultimate one in insert mode
Xmap = {\p
X"	edit previously editted file
X"
X"
X"
X"	other macros
X"
X"map  :w
X"	write out the file
X"
Xmap * i
X"	split line
X"
Xmap g G
X"	because it's easier to type
X"
X"map  :stop!
X"	unconditional stop
Xmap ' `
X"	so we return to exact position, not just ^ on 'a or ''
Xmap Y y$
X"	so Y is analagous to C and D
Xmap  ddu
X"	single-line redraw
Xmap  :n +/
X"	go to next file in arg list, same position 
X"	useful for "vi +/string file1 file2 file3"
X"
X"
X"	META MACROS, all begin with meta-key '\' ; more later in file
X"
Xmap 	 \
X"	so can use both ^I and \ for meta-key
X"
Xmap \/ d$Po/\<pA\>"wdd@w
X"	find current word, uses w buffer
X"
Xmap \C ok:co.:s/./ /g
o80a :-1s;^;:s/;
:s;$;//;
"mdd@m:s/\(.\)./\1/g
:s;^;:-1s/^/;
"mdd@mjdd
X"	center text.  there's a better way, but i lost the short version.
X"
X"	INVERT CASE ON WORDS -- V is like W, v is like w.  3V is fine, but only to EOL.
X"	uses both register n and mark n.
Xmap \v ywmnoP:s/./\~/g0"nDdd`n@n
X"	abc -> ABC    ABC->abc
Xmap \V yWmnoP:s/./\~/g0"nDdd`n@n
X"	abc.xyz -> ABC.XYZ    ABC.XYZ->abc.xyz
X"
X"
X"	EXECUTION MACROS --	these two are for executing existing lines.  
X"
Xmap \@ "mdd@m
X"	xqt line as a straight vi command (buffer m, use @@ to repeat)
Xmap \! 0i:r!"ndd@n
X"	xqt line as :r! command (buffer n, use @@ to repeat)
X"
Xmap \t :r!cat /dev/tty
X"	read in stuff from X put buffer
X"	
X"	c-hacking exrc source, useful on c programs et al, but not text
X"
X"set tags=tags\ /mnt/tchrist/tmptags\ /usr/lib/tags
X"	/tmp/tags is so can make tmp tag file of r/o src dirs
X"	by "set d = $cwd;cd;ctags -twd $d/*.[ch];mv tags tmptags;cd $d'
X"
X"
X"	BLOCK MACROS -- these help when dealing with C blocks
X"
X"	this will begin a block, leaving in insert mode
Xmap!  /}a
X"	and this  will take you past its end, leaving in insert mode
X"
X" 	this will shift the body of a block but not its outer part
Xmap \S >%<<%<<
X"
X"
X"	LINT MACRO.  deletes all text from "lint output:" and below, (if any)
X"	replacing it with lint output in pretty block comment form.  could
X"	do sed work myself, but this is faster.  
X"
X"	the map! is for subsequent map, not by people, 
X"	tho /^Lo would make sense.
X"	this is one of those famous time/space tradeoffs 
X"
Xmap! o __END__ ###
Xmap \l Goo

/o
jdG:w
/o
:r!perl -wc %|& splain
?
jme
Xmap \e yypk:.s/.* line ([0-9]+).*/me\1Gk/
"mdd@m
X"
X"	indent this for me
X"
Xmap \i :%!indent -i4
X"
X"	COMMENTING MACROS -- these are actually pretty amazing
X"
X"	from edit mode, this comments a line
X"map  ^i/* A */^
X"
X"	and this undoes it
X"map  :s/\/\* \([^*]*\) \*\//\1
X"
X"	this next one defeats vi's tail-recursion defeatism
X"	called by 2 maps following this one 
X"map!  :unmap! 
X"
X"	while in insert mode, this will put you "inside" a comment
X"map!  :map!  aoa /*  */hhi
X"
X"	while in edit mode, this begins a block comment -- ^N to escape
X"map \c	O/* *  
*/k:map! 
 
*  
A
X"
X"	and this is for adding more lines to a block comment -- ^N to escape
X"map \o	:map!  
*  
A
X"
X"
X"	this stuff (probably) only works with UW vi.  commented out.
X"
X"set tagstack
X"	so we can :tag and :pop deeper than 1 level
X"set filestack
X"	so we can tag lookup on files and pop off
X"set path=/mnt/tchrist
X"	so we can say "vi foo" or ":n foo" and look all those places
X"	if the file is relative and not in .
X"set ?S1200:window=8
X"	if (speed==1200) set window=8
X"	cause the default is too much.
X"set ?Tcitc:fastfg
X"	if (term==citc) set fastfg
X"	
X"	c-hacking exrc source that only works with UW vi
X"
X"set tagprefix
X"	allows abbreviated tags.  better than std taglength
X"
X"
X" 	things i want active when editing text not programs
X"	
X"set ignorecase
X"
X"	cause this is test
Xset wraplen=75
X"set wrapmargin=5
X"	this sets autowrap 5 from right margin
X"
X"
Xmap _ i_ll
X"	this character will now be underlined when less'd, rn'd, etc.
X"
X"	SPELL MACROS
X"
Xmap \s :wgo:$r!spell %
X"	spell the file, placing errors at bottom, use \w to find
Xmap \n Gdd\/
X"	for find next spelling error
X"
X"
X"	FORMATING MACROS
X"
Xmap \P :.,$!fmt -75
X"	format thru end of document
Xmap \p !}fmt -75
X"	format paragraph
Xmap \f 1G/---j:.,$!fmt -75
X"	format message
X"
Xmap \r 1G/^-/:r!snipquote $editalt /^-/jma
X"	read in @, quoted (for MH replies, who link @ to current file)
Xmap \d :s/$/ $/$r 74|? 
s
$xx0
X"
X"
Xmap!  {} O
X"
X"
X
X" for when terminals have the damn escape key in the wrong place
X"map! ` 
Xabbr interphase interface
Xabbr wtih with
Xabbr tihs this
SHAR_EOF
  : || $echo 'restore of' '.nexrc' 'failed'
fi
rm -fr _sh30974
exit 0
-- 
	Tom Christiansen	tchrist@jhereg.perl.com
:The only reason [not to use] perl is that some sysadmins don't allow software that they didn't pay for.
By all means, let them send me money if it makes them feel better.  :-)
	--Larry Wall in <1993Dec13.213032.26623@netlabs.com>


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

Date: Tue, 28 Apr 1998 13:44:14 -0700
From: Rahul Pandey <rpandey@geocities.com>
Subject: Please suggest: perlfaq4 example does not work
Message-Id: <35463F9E.354FEEB3@geocities.com>

Hi,

The example in perlfaq4 (How can I count the number of occurrences of a
substring within a string?) at:

http://www.perl.com/CPAN-local/doc/manual/html/pod/perlfaq4/How_can_I_count_the_number_of_oc.html

    $string = "-9 55 48 -2 23 -76 4 14 -44";
    while ($string =~ /-\d+/g) { $count++ }
    print "There are $count negative numbers in the string";

does not work for me.

Though I know that there is alway a better way to do it, at present the
only way I see to get it working is:

    my $string = "-9 55 48 -2 23 -76 4 14 -44";
    my @modstr = split(/ /, $string);
    my $num;
    my $count = 0;
    foreach $num (@modstr) {
        if ($num =~ /-\d+/) {
            $count++;
        }
    }
    print "count = $count\n";

Suggestions please?

thanks,
rahul



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

Date: Tue, 28 Apr 1998 20:11:04 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Abigail <abigail@fnx.com>
Subject: Re: rename funciton (was: Re: Dummie question)
Message-Id: <Pine.GSO.3.96.980428130928.15049m-100000@user2.teleport.com>

On 28 Apr 1998, Abigail wrote:

> Tom Phoenix (rootbeer@teleport.com) wrote on MDCCI September MCMXCIII in
> <URL: news:Pine.GSO.3.96.980428101400.15049J-100000@user2.teleport.com>:

Was that a Tuesday? :-)

> ++ On Mon, 27 Apr 1998, yary h. wrote:
> ++ 
> ++ > It always bothered me that Perl comes with "rename", but not "copy".
> ++ 
> ++ Give us a system call which does "copy", and we'll make a Perl built-in
> ++ which does so. :-)

> Could you point out the "grep" system call from me?

No, I couldn't. But you knew that, and were merely being sarcastic,
weren't you?

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 1998 20:23:44 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: rename funciton (was: Re: Dummie question)
Message-Id: <6i5dsg$jtg$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, abigail@fnx.com writes:
:Could you point out the "grep" system call from me?

It's not as though Perl's C<grep> function were very grep(1)ish.

    $hogs = grep { $disk_space{$_} > 1e7 } keys %disk_space;

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    break;                          /* don't do magic till later */
        --Larry Wall in stab.c from the perl source code


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

Date: Tue, 28 Apr 1998 16:45:34 -0400
From: Bob Trieger <sowmaster@juicepigs.com>
To: james_leigh@vapower.com
Subject: Re: test post
Message-Id: <35463FEE.209E@juicepigs.com>

Leigh wrote:
> 
> just a test of posting

and you didn't have the brains to post it to a test newsgroup?

-- 
Bob Trieger               |  Titanic: big boat, bigger
sowmaster@juicepigs.com   |           iceberg, big deal


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

Date: 28 Apr 1998 15:56:08 -0400
From: hallm4@cortez.sss.rpi.edu (Agent Hall)
Subject: uninitiated value warning... why?
Message-Id: <6i5c8o$8ghs@cortez.sss.rpi.edu>

Here's my code snippet:

use vars qw(%newhosts $h $p);

open(FILE,"$opt_f") || die "Can't open alternative file:$!";

while(($h,$p) = split(/,,/,<FILE>) {
 chomp($p); # is there a way to do this in the while statement?
 $newhosts{$h} = $p;
}

close(FILE);

I get a warning of an unintialized variable on the 
$newhosts{$h} = $p line, so I thought, "Ok, I'll
just do a $h=''; and $p=''; and %newhosts=(); before
the loop. Still no go. 

When I break the loop apart into some more lines, the
problem disappears. Namely:

while(<FILE>) {
 ($h,$p) = split(/,,/,$_);
 chomp($p);
 $newhosts{$h} = $p;
}

Works fine. Just wondering why... no real problem here. :)

Thanks for your time.



-- 
<HTML><META HTTP-EQUIV="Refresh"
CONTENT="8;URL=http://www.wankers.com"><BODY bgcolor="red"
text="black"><BLINK><STRONG><FONT SIZE=+7> <P>HTML is *BAD* in
Usenet!<P>Turn it off now!<P></STRONG></BLINK></BODY></HTML>


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

Date: Tue, 28 Apr 1998 20:28:37 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Quentin  Fennessy <quentin@shaddam.amd.com>
Subject: Re: unrecognizable switch
Message-Id: <Pine.GSO.3.96.980428132154.15049r-100000@user2.teleport.com>

On 28 Apr 1998, Quentin  Fennessy wrote:

> Jeff, I've seen this under SunOS 4 if you invoke perl with an initial
> line like this:
> 
> 	#!/usr/bin/perl -w<SPACE>
> 
> Note the trailing <SPACE> after -w?  It is hard to see!  On SunOS4 I
> get:
> 
> 	Unrecognized switch: -    (-h will show valid options).

Although some would certainly argue that your system should better
understand whitespace, in any case the diagnostic message could be a bit
clearer. Maybe we could use the following patch. Hope this helps!

--- perl5.004_04.orig/perl.c	Mon Nov  3 07:21:15 1997
+++ perl5.004_04.space_arg/perl.c	Tue Apr 28 13:14:29 1998
@@ -699,6 +699,12 @@
 	    break;
 	case 0:
 	    break;
+    case ' ':
+    case '\t':
+    case '\f':
+    case '\n':
+    case '\r':
+		croak("Unrecognized switch: whitespace character");
 	case '-':
 	    if (!*++s || isSPACE(*s)) {
 		argc--,argv++;

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: 28 Apr 1998 22:21:51 +0200
From: Terje Kvernes <terjekv@ifi.uio.no>
Subject: Re: using perl as a script
Message-Id: <wxxhg3dr928.fsf@refil.ifi.uio.no>

phillip@javanet.com writes:

> Basically what I was wondering is is it possible to make a perl script that
> runs and ever 3 ours or so (or even several specified times like 7:30, 9:00,
> 12:00 and so on) to count how many new messages in the mail spool, and then
> in turn send a message to a specified e-mail address formatted like this.
> "You currently have # new messages in your inbox." Or would I have to use
> another language such as C or something. And if I could do this how would I
> go about learning how to do this. I really would like to know how as soon as
> possible.

On Unix-systems: cron(tab) is your friend. -> man crontab
For windows I have no idea.

You could ofcourse do something like:

for (;;) {
	&sendmail(&countmails($mailfile));
	sleep(3600); 
}	

But i don't think thats what you _really_ want... =)

-- 
Terje Kvernes
http://www.stud.ifi.uio.no/~terjekv/


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

Date: Tue, 28 Apr 1998 16:41:11 -0400
From: David Boyce <David.Boyce@fmr.com>
Subject: Re: warnings and Getopt::Std
Message-Id: <35463EE7.2740A38E@fmr.com>

Bill Mooney wrote:
> Is there a "standard" way to remove these warnings?

Previous responses suggest the "vars" pragma, which is the correct
general solution.  Another way to deal with your specific problem is to
use Getopt::Long (note that there's nothing wrong with using
Getopt::Long to process "short" options). This allows you to pass a
reference to a hash instead of populating a bunch of scalars:

	use Getopt::Long;
	GetOptions(\%Opt, 'v');
	print "-v\n" if $Opt{v};

This not only keeps your namespace cleaner but as you can see, taking
the reference to %Opt causes it to be mentioned at least twice: thus no
warning.

-David


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

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

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