[8540] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2157 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Mar 22 13:07:30 1998

Date: Sun, 22 Mar 98 10:00:37 -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: 2157

Today's topics:
        Another novice needing RegExpr help.... (stephen benson)
    Re: Another novice needing RegExpr help.... (stephen benson)
    Re: Another novice needing RegExpr help.... (stephen benson)
    Re: Can't understand /g (match global) operator - help! (Bart Lateur)
    Re: for ($x,$y) ([0,0]..[5,5]) revisited <roland@consol.de>
        help needed for a regexp <nick.hill@virgin.net>
    Re: help needed for a regexp (A. Deckers)
    Re: Help with NT4 Wks <LPHAM@prodigy.net>
        Help with Selena Sol Classified Script <sdunnam@nospam-flyfishingjournal.com>
    Re: Is there a "Newsgroup" for Newbies to Perl? (I R A Aggie)
        Is there a script for this? <doug@ccinet.com>
        Newbie: What to do with WORDSLIST? <doug@ccinet.com>
        Perl + Tk? (Ken Knecht)
        perl databases ?? (Ryan)
    Re: Perl for Win32 {NT4.0 sp3} simple scripting probs.. (Jason Gloudon)
    Re: PerlRing??? (Joergen W. Lang)
    Re: PerlRing??? (Joergen W. Lang)
    Re: PerlRing??? (I R A Aggie)
    Re: PerlRing??? (Joergen W. Lang)
        PerlScript question(s) <bret@bellsouth.net>
        Please ignore, I just want the autofaq <chrisb@glen-net.ca>
    Re: print inside of loop occurs outside of loop??? <jdf@pobox.com>
    Re: system commands running but not .exe from perl scri (WarezSpider)
    Re: Testing website PERL <LPHAM@prodigy.net>
    Re: Win95 glob for filenames returns values but not int <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 22 Mar 1998 15:29:40 GMT
From: stephenb@scribendum.win-uk.net (stephen benson)
Subject: Another novice needing RegExpr help....
Message-Id: <35152bdf.24791798@nntp.ibmpcug.co.uk>

I'm trying to build a script which scans html to find files included
by FrontPage, deletes them and replaces the deleted text with the
title of, and a link to,  the ex-included file. I'm doing it bit by
bit, with some success, but trying to extract text split over lines is
eluding me... why does this script match lines 45 and 75, but not
58/59

This is the script:

>open(TESTFILE, "testPN_n.html") or die "Can't open testfile: $!\n";
>while ($line = <TESTFILE>) {
>    if ($line =~ /(WW.*Notes*.*to.*\d*\.\d+)\s*.*/s) {
>		print "line number: $.";
>		print "\n";
>        print "line = $line\n";
>		print "1 = $1\n";
>		print "__________________________\n\n";
>    }
>}

># looking for:
># <strong>WW Note to
>#            5.1</strong>

This is the script output:

>line number: 41
>line = <a href="ww_notes_to_5_1.html#bc0028de" target="bas"><img src="../../share_images/footnote_2.gif" alt="iFootnote 2: click to view" border="0" width="11" height="13"></a> <a href="ww_notes_to_5_1.html#WW Note to 5.1 no 3" target="bas"><img src="../../share_images/footnote_3.gif" border="0" width="11" height="13"></a>. In schemes where contributions are calculated

>1 = WW Note to 5.1
>__________________________

>line number: 75
>line =     <p><a name="WW Note to 5.1 no 3" target="bas"><font size="2" face="Arial, Helvetica, Verdana"><strong>3.</strong></font></a><font size="2" face="Arial, Helvetica, Verdana"> This requirement

>1 = WW Note to 5.1
>__________________________

This is the relevent text from the file (line numbers added):

>line 40: <a href="ww_notes_to_5_1.html#bc0028dd" target="bas"><img src="../../share_images/footnote_1.gif" alt="Footnote 1: click to view" border="0" width="11" height="13"></a>
><a href="ww_notes_to_5_1.html#bc0028de" target="bas"><img src="../../share_images/footnote_2.gif" alt="iFootnote 2: click to view" border="0" width="11" height="13"></a> <a href="ww_notes_to_5_1.html#WW Note to 5.1 no 3" target="bas"><img src="../../share_images/footnote_3.gif" border="0" width="11" height="13"></a>. In schemes where contributions are calculated

>            <td width="10">&nbsp;</td>
>line 58:            <td valign="top"><a name="c920b3cd" target="bas"><font size="2" face="Arial, Helvetica, Verdana"><strong>WW Note to
>line 59:            5.1</strong></font></a><font size="2" face="Arial, Helvetica, Verdana"> </font></td>

>    continue to contribute after NRD - see paragraph </font><a href="../Part04/contributions_after_normal_retir_n.html" target="aumilieu"><font size="2" face="Arial, Helvetica, Verdana">4.8</font></a><font size="2" face="Arial, Helvetica, Verdana">. </font></p>
>line 75: <p><a name="WW Note to 5.1 no 3" target="bas"><font size="2" face="Arial, Helvetica, Verdana"><strong>3.</strong></font></a><font size="2" face="Arial, Helvetica, Verdana"> This requirement
>    is clearly subject to the surpluses requirements. </font></p>

Then I have to see how Javascript handles the REs I build.... 

-- stephen benson
stephenb@scribendum.win-uk.net || stephen_benson@watsonwyatt.co.uk
http://www.ibmpcug.co.uk/~2i/ || http://www.scribendum.win-uk.net/
__________________________________________________________________


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

Date: Sun, 22 Mar 1998 16:26:20 GMT
From: stephenb@scribendum.win-uk.net (stephen benson)
Subject: Re: Another novice needing RegExpr help....
Message-Id: <35153922.28186660@nntp.ibmpcug.co.uk>

I thought I should add that, although I like an easy life, offers of
which added parse etc modules to use won't really help because I'm
using Perl as a direct form of testing, but I want to try to use the
resulting RE in Javascript (realising it'll probablly perform badly)
or even SR32 (a windowed Search/Replace prog with some RE support).
Finally I may be able to use the Perl/modules solution, but not
necessarily. Besides, for the sake of understanding, I'd like a
vanilla Perl/RE solution.

On Sun, 22 Mar 1998 15:29:40 GMT, stephenb@scribendum.win-uk.net
(stephen benson) wrote:

>I'm trying to build a script which scans html to find files included
>by FrontPage, deletes them and replaces the deleted text with the
>title of, and a link to,  the ex-included file. I'm doing it bit by
>bit, with some success, but trying to extract text split over lines is
>eluding me... why does this script match lines 45 and 75, but not
>58/59
>
>This is the script:
>
>>open(TESTFILE, "testPN_n.html") or die "Can't open testfile: $!\n";
>>while ($line = <TESTFILE>) {
>>    if ($line =~ /(WW.*Notes*.*to.*\d*\.\d+)\s*.*/s) {
>>		print "line number: $.";
>>		print "\n";
>>        print "line = $line\n";
>>		print "1 = $1\n";
>>		print "__________________________\n\n";
>>    }
>>}
>
-- stephen benson
stephenb@scribendum.win-uk.net || stephen_benson@watsonwyatt.co.uk
http://www.ibmpcug.co.uk/~2i/ || http://www.scribendum.win-uk.net/
__________________________________________________________________


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

Date: Sun, 22 Mar 1998 17:25:04 GMT
From: stephenb@scribendum.win-uk.net (stephen benson)
Subject: Re: Another novice needing RegExpr help....
Message-Id: <3515493f.32311892@nntp.ibmpcug.co.uk>

Clearly I'm making an elementary mistaked; none of these work -- I'm
trying to get titles broken after the "to"; all that varies is the
number, and Note(s). Although I'd like to allow for double spaces etc

/(WW Notes* to\s+\d*\.\d+)\s*.*/s

/"(WW\s+Notes*\s+to\s+\d*\.\d+).*"/s

/(WW Note to \d*\.\d+)/s

/(WW.Notes*.to.\d*\.\d+)\s*.*/s

/"(WW.Notes*.to.\d*\.\d+)\s*.*"/s


(some of this also tried to pick up titles with additional trailing
matter)

# looking for:
# <strong>WW Note to
#            5.1</strong>
#
# /\<strong\>WW Note to \d*\.\d+\<\/strong\>/s
-- stephen benson
stephenb@scribendum.win-uk.net || stephen_benson@watsonwyatt.co.uk
http://www.ibmpcug.co.uk/~2i/ || http://www.scribendum.win-uk.net/
__________________________________________________________________


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

Date: Sun, 22 Mar 1998 16:21:34 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Can't understand /g (match global) operator - help!
Message-Id: <35162660.2633159@news.tornado.be>

brosser@gil.com.au wrote:

>But, near the end of the project, I'm coming a cropper -
>perl's not working the way I'd expect, so there must be
>(many!) things I still don't understand.

>1.	"abc" =~ /([abc])*/g	gives (c, undef).

You're using parentheses with a star on the OUTSIDE of them. That is a
sure way to make Perl behave in ways you wouldn't expect. Randal
Schwartz goes through great lengths in explaining the behaviour it
displays, but my simple advice is simply: don't do it, unless you
absolutely have to. Note: a plus is nearly just as bad.

>	Why doesn't it match the 'a' first, then the 'b',
>	and then the 'c', giving (a,b,c)

If you want that, simply drop the star:

	@matches = /([a,b,c])/g;

will fill @matches with ('a','b','c'). Just as you'd like it to be.

	Bart.


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

Date: 22 Mar 1998 16:21:10 +0000
From: Roland Huss <roland@consol.de>
Subject: Re: for ($x,$y) ([0,0]..[5,5]) revisited
Message-Id: <m3zpiid7d5.fsf@pirx.roland.consol.de>

Je ne care pas! <jefpin@bergen.org> writes:

> Granted, it isn't very glamorous... :)  But the trouble is, in the module
> itself, I'm stuck with not being able to C<my> variables, and I don't want
> to make global ones (not good coding, I think)...

I agree,  global variables are  almost always evil. However, there are
cases, when you shouldn't be  too puristic  (another example, where  a
relaxed attitude might help  you  avoiding extra  pains, is  the often
cited example with the hell-invented  'goto' and nested loops...). And
I think, your Iterator class  can be considered as  such a case.  Even
Perl's  'sort'   uses  package global  variables   for  the  comparing
function.

Taking the interface of 'sort' as an example, here's a quick and dirty
version of an Iterator  class springing in my  mind, where the package
global variables $It::a...$It::z are   used as iterator  variables.  I
don't claim it  to be very efficient  (note  the recursive calls)  nor
especially clever. It's simply one of those many ways ... ;-)

 ...roland


test.pl:
========
use It;

iterate([[0..2],[2..3]],sub { print "($It::a,$It::b)\n" });

It.pm:
======
#!/usr/bin/perl -w
package It;
use strict "vars";

use Exporter();
use vars qw( @ISA @EXPORT );

@ISA = qw( Exporter );
@EXPORT = qw( &iterate );

BEGIN {
	my $vars_l = join(" ",map("\$$_","a".."z"));
	eval("use vars qw($vars_l);");

	# BTW, the following code causes perl 5.004_4 to 
	# die with SIGSEV: (bug report submitted)
	# my $vars = join(",",map("\$$_","a".."z"));
	# eval("local ($vars);");
}

sub iterate {
	my $vals= shift;
	my $sub = shift;
	my $ind = shift || 0;

	if ($ind > $#{$vals}) { 
	  &$sub;
	  return;
	}
	
	foreach (@{$$vals[$ind]}){
	  $ { chr(ord('a')+$ind) } = $_;
	  &iterate($vals,$sub,$ind+1);
	}
}

1;

-- 


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

Date: 22 Mar 1998 16:17:40 GMT
From: "nick hill" <nick.hill@virgin.net>
Subject: help needed for a regexp
Message-Id: <01bd55ae$48e6d600$8347a8c2@default>

If I have the variable $line = "1234,nick,hill,company,3"
what regexp do I use to get the folowing result.

$line1 = 1234
$line2 = nick
$line3 = hill
$line4 = company
$line5 = 3

	Thanks.



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

Date: 22 Mar 1998 17:39:08 GMT
From: alain.deckers@man.ac.uk (A. Deckers)
Subject: Re: help needed for a regexp
Message-Id: <slrn6haj5r.9od.alain.deckers@nessie.mcc.ac.uk>

In <01bd55ae$48e6d600$8347a8c2@default>,
	nick hill <nick.hill@virgin.net> wrote:
>If I have the variable $line = "1234,nick,hill,company,3"
>what regexp do I use to get the folowing result.
>
>$line1 = 1234
>$line2 = nick
>$line3 = hill
>$line4 = company
>$line5 = 3
>
>	Thanks.

Use split.

$perldoc -f split
=item split /PATTERN/,EXPR,LIMIT

=item split /PATTERN/,EXPR

=item split /PATTERN/

=item split

Splits a string into an array of strings, and returns it.

If not in a list context, returns the number of fields found and splits into
the @_ array.  (In a list context, you can force the split into @_ by
using C<??> as the pattern delimiters, but it still returns the array
value.)  The use of implicit split to @_ is deprecated, however.

If EXPR is omitted, splits the $_ string.  If PATTERN is also omitted,
splits on whitespace (after skipping any leading whitespace).  Anything
matching PATTERN is taken to be a delimiter separating the fields.  (Note
that the delimiter may be longer than one character.)  If LIMIT is
specified and is not negative, splits into no more than that many fields
(though it may split into fewer).  If LIMIT is unspecified, trailing null
fields are stripped (which potential users of pop() would do well to
remember).  If LIMIT is negative, it is treated as if an arbitrarily large
LIMIT had been specified.

A pattern matching the null string (not to be confused with
a null pattern C<//>, which is just one member of the set of patterns
matching a null string) will split the value of EXPR into separate
characters at each point it matches that way.  For example:

    print join(':', split(/ */, 'hi there'));

produces the output 'h:i:t:h:e:r:e'.

The LIMIT parameter can be used to split a line partially

    ($login, $passwd, $remainder) = split(/:/, $_, 3);

When assigning to a list, if LIMIT is omitted, Perl supplies a LIMIT
one larger than the number of variables in the list, to avoid
unnecessary work.  For the list above LIMIT would have been 4 by
default.  In time critical applications it behooves you not to split
into more fields than you really need.

If the PATTERN contains parentheses, additional array elements are
created from each matching substring in the delimiter.

    split(/([,-])/, "1-10,20", 3);

produces the list value

    (1, '-', 10, ',', 20)

If you had the entire header of a normal Unix email message in $header,
you could split it up into fields and their values this way:

    $header =~ s/\n\s+/ /g;  # fix continuation lines
    %hdrs   =  (UNIX_FROM => split /^(.*?):\s*/m, $header);

The pattern C</PATTERN/> may be replaced with an expression to specify
patterns that vary at runtime.  (To do runtime compilation only once,
use C</$variable/o>.)

As a special case, specifying a PATTERN of space (C<' '>) will split on
white space just as split with no arguments does.  Thus, split(' ') can
be used to emulate B<awk>'s default behavior, whereas C<split(/ /)>
will give you as many null initial fields as there are leading spaces.
A split on /\s+/ is like a split(' ') except that any leading
whitespace produces a null first field.  A split with no arguments
really does a C<split(' ', $_)> internally.

Example:

    open(passwd, '/etc/passwd');
    while (<passwd>) {
	($login, $passwd, $uid, $gid, $gcos,
	    $home, $shell) = split(/:/);
	...
    }

(Note that $shell above will still have a newline on it.  See L</chop>,
L</chomp>, and L</join>.)

Alain
-- 
 Perl Language: <URL:http://language.perl.com/perl/>
Perl Reference: <URL:http://reference.perl.com/>
      Perl FAQ: <URL:http://www.perl.com/perl/faq/>
  Perl Archive: <URL:http://www.perl.com/CPAN/>


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

Date: Sun, 22 Mar 1998 11:51:11 -0500
From: "Loi N Pham" <LPHAM@prodigy.net>
Subject: Re: Help with NT4 Wks
Message-Id: <6f3fk4$53l4$1@newssvr03-int.news.prodigy.com>

You may install PerlIS.dll.


Marcello Veggiotti wrote in message <3513E598.2667539D@arese.com>...
>Hi all, can someone help me configuring Perl and IIS4 (using the one in
>NT option pack).
>I have perl working on my PC, but when I call a perl file from the
>browser, it askes me to open it. I have set permissions in the
>configuration pannel so to have my cgi-local dir allowed to excecute
>programs and scripts ... files .exe work, but .pl not.
>how can I solve it?
>
>Please, send a copy directly to me:
>net4u@arese.com
>




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

Date: Sun, 22 Mar 1998 10:36:37 -0600
From: "Sherman Dunnam" <sdunnam@nospam-flyfishingjournal.com>
Subject: Help with Selena Sol Classified Script
Message-Id: <6f3hph$pu$1@fox.dpliv.com>

I am having trouble with the Selena Sol Classified Ad Manager script and am
hoping someone can help.  The script I am using is the one from the book
"Instant Web Scripts with CGI/Perl" not the one posted on his web page.
(Although I tried that one with exactly the same symptoms.)

I am a PERL newbie, and a relative UNIX newbie though I have been
programming in the DOS/Windows world for about 11 years.

I have installed the script on my server and have it running.  When adding
items to the datafile it works perfectly.  However when either deleting
items or modifying items it does not work.  Here are the symptoms-

When deleting-
the search function to find the records the user is allowed to delete works
fine then apparently nothing happens, I get the message that the item had
been deleted but it is still there.

When modifying-
again the search function to find records the user is allowed to modify
works fine but instead of a modification to the original line in the
datafile, I get a new line appended that contains only the modified
field(s), the delimiting pipe symbols are there but there is no data between
them and the original record is still in the file.

Suspicions-
I suspect the problem is in some way related to the scripts use of a temp
file to copy the database info into as this is what both Delete and Modify
have in common that Add does not.  Other than that I am stumped.

--
---
Sherman
www.flyfishingjournal.com





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

Date: Sun, 22 Mar 1998 11:22:29 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is there a "Newsgroup" for Newbies to Perl?
Message-Id: <fl_aggie-2203981122290001@aggie.coaps.fsu.edu>

In article <6f34pt$b0a@newsops.execpc.com>, Mark Stackhouse
<stackhou@execpc.com> wrote:

+ 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!

You can't. You have to become a programmer. I'm sorry, but that is
as much a reality as downsizing. You have to either a) take a formal
course, b) teach yourself, or c) get downsized for lack of performance
if that's the corporate bottom line.

Nothing else is going to work. Don't expect me to do your work for you.
I've got enough on my plate already, thankyouverymuch, and I don't
need to hold your hand. I don't mind clearing up a misconception
about the documentation, or suggesting alternative methods of
solving a given problem, or even pointing you to a specific section
of the docs for you to look at.

But I do mind it when people don't even bother to _look_ at the
docs, _especially_ the FAQs. I do mind it when they expect me
to give them their answer, gratis.

+ 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.

No, we'll just create a moderated newsgroup, where such questions
will be refered to the documentation. And I doubt I'll read the
clp.misc newsgroup after a moderated newsgroup comes on-line.

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 14:41:15 GMT
From: "Doug Evans" <doug@ccinet.com>
Subject: Is there a script for this?
Message-Id: <fq9R.203$eq6.420918@katana>

Hi,

I currently have an Access database, on line. It contains part numbers, of
semiconductors, and has 5 columns. I currently use a single line query, that
requires input = partnumber. I would like to change that single line query
to a text box, where any number of partnumbers can be inputed.

Is there an existing script that does this?

Thanks,
Doug




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

Date: Sun, 22 Mar 1998 16:32:27 GMT
From: "Doug Evans" <doug@ccinet.com>
Subject: Newbie: What to do with WORDSLIST?
Message-Id: <v2bR.247$eq6.487310@katana>

I am using NT4.0 WS, Standard Perl

The sub routine that I am having trouble with is...

sub init_words {
    open (WORDSLIST, "wordslist") ||
    die "can't open wordslist:$!";
 while (defined ($name = <WORDSLIST>)) {
    chomp ($name);
    $word = <WORDSLIST>;
    chomp ($word);
    $words{$name} = $word;
 }
 close (WORDSLIST);
}

The question is where do I put the wordslist file, and what extension does
it get?

Thanks,
Doug




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

Date: 22 Mar 1998 09:16:00 -0700
From: kenk@primenet.com (Ken Knecht)
Subject: Perl + Tk?
Message-Id: <6f3dg0$j0p@nntp02.primenet.com>

Could someone point me to information about using Tk in Perl, or vice-versa, 
as mentioned in another thread here? None of my Perl books mention Tk in the 
index, and my Tk-Tcl book doesn't mention Perl.

TIA.

Ken


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

Date: Sun, 22 Mar 1998 16:56:51 GMT
From: ryan@remove-this-mmainteractive.com (Ryan)
Subject: perl databases ??
Message-Id: <35153f56.126778213@news.willinet.net>

Hello. I have an account at a hosting provider, and I'd like to set up
a perl database there. I know perl pretty well, and I've done some
database programming in other languages. But I still don't know where
to start. I've been to perl.com, and done lots of searching. The perl5
modules I have available to me on this acount are listed below. With
this in mind, what type of database should I use, and where do I
start? I plan to have a few hundred records, with less than 10 fields
in each record. One field will be user updateable through the web
page. Thanks a lot for any help.

Ryan

reply to   ryan at mmainteractive dot com

Modules available:
     BSD-Resource-1.06  
     CGI.pm-2.37b6  
     CGI_Imagemap-1.00 
     CGI_Lite-1.8  
     Compress-Zlib-0.50 
     Convert-UU-0.04 
     Curses-1.01 
     DB_File-1.54  
     DBD-mSQL-0.65  
     DBI-0.90  
     Data-Dumper-2.07 
     File-Flock-96.111802 
     File-Tools-2.0 
     GD-1.14 
     HTML-QuickCheck-1.0b1 
     HTML-Stream-1.40  
     IO-1.1801  
     Logfile-0.115 
     MD5-1.7 
     MIME-parser-1.13 
     MLDBM-1.22 
     MsqlPerl-1.17 
     Net_SSLeay.pm-0.04  
     PGP-0.3a 
     SHA-1.1 
     Socket-1.5 
     Term-ReadLine-0.97 
     TermReadKey-2.09  
     Text-Tabs+Wrap-97.011701 
     libnet-1.0506  
     libwww-perl-5.14  


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

Date: Sun, 22 Mar 1998 17:27:00 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Perl for Win32 {NT4.0 sp3} simple scripting probs...
Message-Id: <slrn6haicj.5sm.jgloudon@manitoba.bbn.com>

Troy Coulombe <troy.c@scsi-online.net> wrote:
>REF: Learning Perl page 87 -->  $sentence=~/$what/
>
>Having RTF[M,FAQ]
>$OPTION=qw(0 1 2 3 4);

@OPTION = qw(0 1 2 3 4);

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

You want to look for $choice in the array @OPTION ?
until (grep /^$CHOICE$/, @OPTION);

You may want to trim whitespace from $CHOICE before trying to match
it with the options, Alternatively you could create a hash whose keys
are the valid options.

You could even use the hash to do your menu processing say,
define your menu options to point to your subroutines using references:

sub quit { }

sub somethingelse { }

sub anotherfunction { }

%validoptions = {
0 => \&quit
1 => \&somethingelse
2 => \&anotherfunction
}

Call the appropriate subroutine:
&{$validoptions{$OPTION}} if exists $validoptions{$OPTION};

You would need to read up on references to understand this way,
but this might be reason to jump ahead in reading :).

-- 
Jason Gloudon


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

Date: Sun, 22 Mar 1998 17:12:01 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: PerlRing???
Message-Id: <1d6at70.tr5c7d1hrwztmN@host055-206.seicom.net>


Mark Stackhouse <stackhou@execpc.com> wrote:

> Why hasn't
> such an efficient tool been incorporated into Perl FAQ and
> Perl DOCS?

> 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,
> 
> 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

And now you wonder why this didn't bring up the results you were looking
for ? 
Or do you ask for an additional search enginge on the documentation
pages ?
I suppose I mistook you in the first place, sorry.

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


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

Date: Sun, 22 Mar 1998 17:12:03 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: PerlRing???
Message-Id: <1d6avkb.1mbvxv2u2h5l5N@host055-206.seicom.net>

I R A Aggie <fl_aggie@thepentagon.com> wrote:

> In article <1d69hyw.a1yeooyjyakgN@host043-206.seicom.net>,
> joergen.lang@schwaben.de (Joergen W. Lang) wrote:
> 
> + Since Perl is cross-platform, maybe it would be a good idea to have a
> + cross-platform version of the docs instead of (or complementing) the
> + pod-files ?
> 
> pod2html. It should be included in the distribution. Someone has
> even gone as far as converting the docs into searchable PDF documents.
> 
> Thank that person. That should be platform independent enough.
> 
> James

I'm definetely thankfull to to all those people who put such a great
effort into creating and porting the docs. 
I was only wondering if it was a good idea to have a standardized format
of the docs coming with every distribution of perl, which could be
accessed in the same manner on every machine. 

At the moment UNIXers go "perldoc", Mac users have Shuck and BBedit, I
don't know what DOS/Win users have to do...

Why not making a HTML or PDF Version of the docs part of the
distribution. If people who have first time contact with their
distribution of Perl and find the docs in a format, they're familiar
with they might even make an effort to have a look at it.

Another aspect of the situation is that these days a lot of people don't
start up with Perl the "classic programmer's" way. Instead they get
themselves some nice script from the net, try to get it working on their
ISPs machine. Then they get stuck, see the #!/usr/bin/perl and think
"Hey wasn't there a Perl Newsgroup ?" The rest is known...

Maybe Perl authors who publish their scripts, especially those who claim
those scripts to be ("easily") reused, should be encouraged to include a
pointer to the Perl resources/documentation so first time perlers who
come in that door won't be too misguided. 


lazy, impatient and full of hubris :-) 
Joergen
-- 
-------------------------------------------------------------------
   "Everything is possible - even sometimes the impossible"
             HOELDERLIN EXPRESS - "Touch the void"
-------------------------------------------------------------------


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

Date: Sun, 22 Mar 1998 11:10:24 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: PerlRing???
Message-Id: <fl_aggie-2203981110240001@aggie.coaps.fsu.edu>

In article <6f1ofg$qca@newsops.execpc.com>, Mark Stackhouse
<stackhou@execpc.com> wrote:

+ 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.

Perhaps you should try perlindex? you'll have to install it, and figure
out how to use it, and how to interpret the results...

% perlindex scalar
1  1.372 lib/perl5/Tie/Scalar.pm
2  1.067 lib/perl5/pod/perldata.pod
3  0.549 lib/perl5/I18N/Collate.pm
4  0.437 lib/perl5/pod/perlsub.pod
5  0.317 lib/perl5/pod/perlfaq7.pod
6  0.300 lib/perl5/constant.pm
7  0.294 lib/perl5/pod/perlfunc.pod
8  0.284 lib/perl5/site_perl/HTTP/Headers.pm
9  0.272 lib/perl5/pod/perlop.pod
a  0.261 lib/perl5/pod/perlfaq4.pod
b  0.251 lib/perl5/pod/perlref.pod
c  0.249 lib/perl5/site_perl/Image/Size.pm
d  0.229 lib/perl5/site_perl/LWP/SecureSocket.pm
e  0.212 lib/perl5/pod/perlguts.pod
f  0.210 lib/perl5/pod/perltie.pod

Enter Number or 'q'> 2

[snip]

          Scalar values are always named with '$', even when referring
          to a scalar that is part of an array.  It works like the
          English word "the".  Thus we have:

              $days               # the simple scalar value "days"
              $days[28]           # the 29th element of array @days
              $days{'Feb'}        # the 'Feb' value from hash %days
              $#days              # the last index of array @days
[snip]

Is that what you meant?

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 17:35:26 +0100
From: joergen.lang@schwaben.de (Joergen W. Lang)
Subject: Re: PerlRing???
Message-Id: <1d6az4r.47rbha1dtfxgaN@host055-206.seicom.net>

Nathan V. Patwardhan <nvp@shore.net> wrote:

> Joergen W. Lang (joergen.lang@schwaben.de) wrote:
> 
> : <musings>
> 
> : Since Perl is cross-platform, maybe it would be a good idea to have a
> : cross-platform version of the docs instead of (or complementing) the
> : pod-files ?
> 
> Oh, go on with your bad self.  Shoo!  Shoo!
> 
> Seriously, when you build/install the win32 standard port, you should
> be asked if you want to install HTML docs.  Just say yes.  

Now, after saying "Yes" about two hundred times, my neighbours start
giving me these weird looks but I still don't get asked if I want to
install HTML docs....

Maybe that's because I'm on a Mac... ;-))

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


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

Date: Sun, 22 Mar 1998 15:43:46 GMT
From: "Bret deFranza" <bret@bellsouth.net>
Subject: PerlScript question(s)
Message-Id: <01bd55a9$2b031c20$283c6020@sparky.al.bst.bls.com>

V2hlcmUgZG9lcyBvbmUgZmluZCBkb2N1bWVudGF0aW9uL2V4YW1wbGVzL2hlbHAgb24gUGVybFNj
cmlwdCdpbmcgd2l0aCBJSVMgNC4wPyAgSSBoYXZlIGRvd25sb2FkZWQgYW5kIHN1Y2Nlc3NmdWxs
eSBpbnN0YWxsZWQgdGhlIG5lY2Vzc2FyeSBmaWxlcyBmb3IgUGVybDMyLCBQZXJsIElTQVBJIGFu
ZCBQZXJsU2NyaXB0IGZyb20gQWN0aXZlc3RhdGUgKGJ1aWxkIDMxNikgYW5kIGhhdmUgcmV2aWV3
ZWQgdGhlaXIgZXhhbXBsZXMuICBFdmVydGhpbmcgYXBwZWFycyB0byBiZSB3b3JraW5nIGZpbmUs
IGFuZCBJIHdhbnQgbW9yZSBpbmZvIG9uIFBlcmxTY3JpcHQuICBJIGhhdmUgc29tZSBQZXJsIGtu
b3dsZWRnZSAoZW5vdWdoIHRvIGJlIGRhbmdlcm91cykgYWxvbmcgd2l0aCBoZWF2eSBJSVMgYW5k
IEZyb250UGFnZSBleHBlcmllbmNlLCBhbmQgSSB3YW50IHRvIHN0YXJ0IGxlYXJuaW5nIGFib3V0
IEFTUCBjcmVhdGlvbiB1c2luZyBQZXJsU2NyaXB0LiAgSSd2ZSBhbHJlYWR5IGdvdCBhbGwgdGhl
IE8nUmVpbGx5IGFuaW1hbCBjb2xsZWN0aW9uIGNvbmNlcm5pbmcgbnVtZXJvdXMgUGVybCB2b2x1
bWVzIGFuZCBKYXZhU2NyaXB0LCBidXQgbm90aGluZyBvbiBQZXJsU2NyaXB0LiAgQWxzbywgc2Vl
IHJlZmVyZW5jZXMgdG8gYSBzaXRlLCB3d3cucGVybHNjcmlwdC5jb20sIGJ1dCBjYW5ub3QgY29u
bmVjdCB0byBpdCAobm8gbG9uZ2VyIHZhbGlkIGluIEROUz8pLiAgQW55Ym9keSBrbm93IG9mIGFu
eSBnb29kIFBlcmxTY3JpcHQvQVNQIHNpdGVzIGFuZCBib29rcz8NCg0KVGhhbmtzLA0KQnJldA0K



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

Date: Sun, 22 Mar 1998 11:19:57 -0500
From: Chris Breckenridge <chrisb@glen-net.ca>
Subject: Please ignore, I just want the autofaq
Message-Id: <35153A21.29AB1DCC@glen-net.ca>

just a post so I can receive the autofaq and not ask stupid questions :)
 .



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

Date: 22 Mar 1998 09:16:36 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: print inside of loop occurs outside of loop???
Message-Id: <90q2hku3.fsf@news.concentric.net>

Aaron Turner <justme@pobox.com> writes:

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

Before you enter your loop (say, at the top of script, with any other
initializations), put this incantation:

   $| = 1;      # set autoflush

Then, in that first flush of gratitude, please go and read the perlvar
document which will explain this variable to you, and will perhaps
give you many other Perlish ideas.

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY


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

Date: Sun, 22 Mar 1998 16:38:16 GMT
From: DemonSpider@hellsWeb.web (WarezSpider)
Subject: Re: system commands running but not .exe from perl script
Message-Id: <35153f9f.37171770@news.sgi.net>

There is some really good documentation on changing the environment
path (temporarily! :-)  ) to force a good path call in "Learning Perl
on Win32" by Randall Swartz. More Docs and example are available at
www.perl.com.

On Sat, 07 Mar 1998 15:45:30 +0530, Manohar Uchil
<manohar.uchil@citicorp.com> wrote:

>I have not been able to run .exe applications from my cgi/perl
>application although the system commands(copy,dir) etc can be executed
>from the perl script.It was suggested to me that I  give the full
>path(of the .exe file) ,so as to make the web browser understand the
>path.This however has not helped.I have WindowsNT on our m/c and are
>using the peer web server.I  have read all the documentation on the
>exec(),system() and ` ` commands,but are still w/o any answers
>for eg
>exec "copy c:\\1.html c:\\scratch\\1"; works ,but
>
>exec "c:\\pkware\\pkunzip c:\\chat1\\lib\\client.zip
>c:\\inetpub\\wwwroot\\sp\\sp1"; does not work
>
>also if I run my .pl file from command prompt both these commands
>work fine.The problem occurs only when the .pl is run from the web.
>      please send cc to vishalpuri@hotmail.com
>
>regards
>
>manohar
>



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

Date: Sun, 22 Mar 1998 11:49:39 -0500
From: "Loi N Pham" <LPHAM@prodigy.net>
Subject: Re: Testing website PERL
Message-Id: <6f3fh6$3q6o$1@newssvr03-int.news.prodigy.com>

I installed Perlis.dll and put the .pl file in inetsrv/scripts directory.
That's how I tested my Perl script.


Progg wrote in message <01bd54a3$0f030320$185cead0@meka>...
>I need a way to test my website PERL scritps on my computer. I don't want
>to have to upload them to the server to find out they don't work. I think
>there may be a way to do this with MS Personal Web Server, but I'm not
>exactly sure. Can anyone help?
>
>Jay Cain




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

Date: Sun, 22 Mar 1998 08:19:47 -0800
From: "Creede Lambard" <$_=qq!fearless\@NOSPAMio.com!;y/A-Z//d;print>
Subject: Re: Win95 glob for filenames returns values but not into array
Message-Id: <6f3dje$esk@bgtnsc03.worldnet.att.net>

JY wrote in message <35143b96.15637298@news.demon.co.uk>...
>Hi
>


<snip>

>Here's my Perl:
>
>@counters = glob("*.tst");
>$items = @counters;
>print "debug number of elements is $items \n";
>print "debug #1 is \"$counters[0]\" \n";
>exit(0);
>
>Here's the output:
>
>C:\xfer\cnt>perl counters
>zero.tst debug number of elements is 0
>debug #1 is ""
>C:\xfer\cnt>
>

Rather odd. When I run the same script (checking my \perl5\bin folder for
"log" files) I get what I expected to see:

debug number of elements is 1
debug #1 is "install.log"

So why is "zero.tst" appearing on your output line? The fact that it's
printing may be a clue as to why this is happening.

--- Creede Lambard
Minister of Irregular Expressions
Programming Republic of Perl





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

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

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