[6896] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 521 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri May 23 11:17:37 1997

Date: Fri, 23 May 97 08:00:26 -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           Fri, 23 May 1997     Volume: 8 Number: 521

Today's topics:
     (1+2)**3 == 3! (Carl B. Quillen)
     Re: (1+2)**3 == 3! (Joel Coltoff)
     Re: +?* matching (Andrey Yushkov)
     Re: avoiding "Use of uninitialized value..." warning (Chipmunk)
     Re: calculation <nnyxcu@ny.ubs.com>
     CGI-ing <denis.trcek@ijs.si>
     From Unix Perl programming to NT Perl Programming... He <snaider@galcom.co.il>
     get a file at a url PLEASE HELP!!!! <visiocad@easynet.fr>
     Re: getting next line in while (Jeff Robertson)
     Re: how do I format text <minaret@sprynet.com>
     Re: How to process logfiles with begin/end brackets? (Joel Coltoff)
     Re: How to use data files? (Chipmunk)
     Re: Looking for sh to perl convert program <merlyn@stonehenge.com>
     Re: mktemp for perl (Mike Stok)
     Re: My keys are numbers... (Jeff Robertson)
     OS/2: Locales / I18N problem: What to do? (Koos Pol)
     Re: parsing one line at a time problem. (Jeff Robertson)
     Re: parsing one line at a time problem. (Chipmunk)
     Re: Patch to Perl 5.004 for case-insensitive patterns ( (Ron Olsen)
     Re: PERL SCRIPT FOR PASSOWRD (Philip Nelson)
     Re: PerlNT/95 gethostbyname <ccu@sbk-ks.de>
     Re: printing 2 dimentinal Hash table (Chipmunk)
     Re: Private area using Perl/CGI (jader@rsabbs.com)
     Re: Problem with anonymous array as instance variable? (Mike Stok)
     Problem: Installing Perl 5.004 on irix 6.4 (D. Alex Neilson)
     Re: Problem: Installing Perl 5.004 on irix 6.4 <jhi@alpha.hut.fi>
     Re: Reading info from animated gif (Nathan V. Patwardhan)
     Re: RegExp tutorial suggestions? (Cornelius Griffin)
     Server side includes to run Perl scripts from web pages <G.Shuetrim@lse.ac.uk>
     Re: Strings as a uniform representation & tcl <grootr@cs.utwente.nl>
     Re: timelocal.pl ? (Chipmunk)
     Re: winnuke <chp95ajs@sheffield.ac.uk>
     Re: yet another perl regex Q (John L. Allen)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 23 May 1997 14:08:14 GMT
From: cbq@shore.net (Carl B. Quillen)
Subject: (1+2)**3 == 3!
Message-Id: <5m48ce$1d4@fridge-nf0.shore.net>

Can someone explain why this happens?  I can't believe that
the perl parser is set up this way:

print (1+2)**3;
3

print 3**3;
27

(Both in perl 4.0pl36, and perl5.003.)

-Carl (cbq@shore.net).



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

Date: Fri, 23 May 1997 14:24:54 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: (1+2)**3 == 3!
Message-Id: <5m49at$4j1@netaxs.com>

In article <5m48ce$1d4@fridge-nf0.shore.net>,
Carl B. Quillen <cbq@shore.net> wrote:
>Can someone explain why this happens?  I can't believe that
>the perl parser is set up this way:
>
>print (1+2)**3;
>3
>
>print 3**3;
>27

Because the documentation says it works that way. See the old
camel page 169 or the new camel on whatever page has it there.

It's also in the online docs

                     *
                     *
                     *
Also be careful not to follow the print
keyword with a left parenthesis unless you want the corresponding right
parenthesis to terminate the arguments to the print--interpose a + or
put parens around all the arguments.

Basically perl is using the if-it-looks-like-a-function-it-is-a-function
rule. And what do you get when you print(1+2)? I'll give you a hint.
It is less than 27.

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

Date: 23 May 1997 08:35:42 GMT
From: andy@fly.donetsk.ua (Andrey Yushkov)
Subject: Re: +?* matching
Message-Id: <5m3ksu$97t@anega.aist.net>

Many thanks to all for help!!!
And now my script works :)

21 May 1997 17:54:52 GMT Eli the Bearded 
(usenet-tag@qz.little-neck.ny.us) wrote:

> Andrey Yushkov <andy@fly.donetsk.ua> wrote:

> ua == Ukraine?
 Yes, you are right!

> >Can't cut the word with ++ :(

> + is a special character to regexps. I am certain this is your
> problem. I am uncertain what you want to do.
 Sorry, I couldn't write more clearly.

> >@arr = split(/\s+/, $str);

> Do you mean "split(/[\s+]/, $str)"? Or did you want + to be special
> there?
 I didn't want special +

> ># Try to cut the first word!
> ># Wrong search operator
> >$str =~ s/^$arr[0]/ /;

> You probably want:

>  $str =~ s/^\Q${arr[0]}\E/ /;
 YES, this is the answer! Thanks!

> Quote the special characters when trying to match them exactly.
 Yes, and this way I use too :)
 
> Elijah
> ------
> hoping I got the {[]} bit right

--
 Andrey Yushkov     <*>   http://fly.donetsk.ua/~andy  


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

Date: 23 May 1997 13:25:32 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: avoiding "Use of uninitialized value..." warning
Message-Id: <5m45sc$pc7$3@dartvax.dartmouth.edu>

In article <33822B4C.2677@santafe.edu>
"Timothy H. Keitt" <tkeitt@santafe.edu> writes:

> Perl is great for this because I don't need to know much about the data;
> the hash (or array) grows as needed.  The problem is that when I use the
> "-w" switch I get lots of "Use of uninitialized value" warnings.  I'm
> looking for a somewhat more elegant solution than adding a check inside
> the while-loop, e.g., "$sum{$x} = 0 unless exists $sum{$n};" or
> "$sum[$x] = 0 unless defined $sum[$x];".  I'd either like to suppress
> the warning or find a way to initialize my hashes and arrays outside my
> main loop.  Anyone know of a solution?

Try setting $^W to 0 before the loop, and setting it back to its
original value after the loop.

>From the perlvar manpages:

     $WARNING
     $^W     The current value of the warning switch, either TRUE or
FALSE.
             (Mnemonic: related to the -w switch.)

Although I don't see what's so awful about checking whether the values
have been defined.

Chipmunk


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

Date: Thu, 22 May 1997 19:18:27 -0400
From: Glen Culbertson <nnyxcu@ny.ubs.com>
To: Mats Larsson <matlar@rsv.se>
Subject: Re: calculation
Message-Id: <3384D443.38EA@ny.ubs.com>

if $line contains your line from cpp, then:

@line = split('\[|\]', $line);  # split on '[' or ']', @line has 3 elements
$len = eval($line[1]);          # $len contains the length you need

     The variable name is easy to extract from $line[0],
either by splitting on \s+, or substituting away the leading 'char   '.


Mats Larsson wrote:
> 
> Below is a fragment from a struct definition:
> ....
>   char   p_typ[SK_P_TYP_LEN - 1];
>   char   id_pers[SK_ID_PERS_LEN -1];
>   char   nr_lop_id_pers[SK_NR_LOP_ID_PERS_LEN - 1];
>   char   nr_lop_inom[SK_NR_LOP_INOM_LEN - 1];
>   char   typ_blankett[SK_TYP_BLANKETT_LEN - 1];
>   char   nr_post[SK_NR_POST_LEN - 1];
>   char   kod_land[SK_KOD_LAND_LEN - 1];
> ....
> After running it thru cpp to evaluate the define and sed to get the extra
> spaces, I get the following:
> ....
>   char   p_typ [ 2 + 1 - 1 ] ;
>   char   id_pers [ 12 + 1 -1 ] ;
>   char   nr_lop_id_pers [ 2 ] ;
>   char   nr_lop_inom [ 4 + 1 - 1 ] ;
>   char   typ_blankett [ 2 + 1 - 1 ] ;
>   char   nr_post [ 5 + 1 - 1 ] ;
>   char   kod_land [ 2 + 1 - 1 ] ;
> ....
> I need to know name and length for every member of the struct.
> I have only char datatypes, it's a struct for a file containing text.
> I will print the name and the value in the file like this :
> ...
> p_typ = 23
> id_pers = 5004186275
> ...
> 
> Is there some smart way to get the length?
> 
> Or do I have go thru every field between [ and ], check value and sign
> and do the calculation "manually"?
> 
> Thank's in advance
> MATS
> ----------------------------------------------------------
> RSV                       |  Tel:   +46 8 7647921 (work)
> Att: Mats Larsson DS/SK1  |
>                           |  Fax:   +46 8 289629
> 171 94 Solna, Sweden      |  Email: matlar@rsv.se


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

Date: Fri, 23 May 1997 14:48:23 +0200
From: DT <denis.trcek@ijs.si>
Subject: CGI-ing
Message-Id: <33859217.5832@ijs.si>

Is there anybody out-there that knows how to write a response from
a HTTP server to a file, that was submitted to this server via
POST method? Is it possible to do it only with shell programming
(awk etc...) without using PERL? A code example would be of a
great help. 

Thanks in advance and please respond also to me directly
as I have sometimes troubles with accessing some groups.

D. Trcek
IJS, Lj, SI
denis.trcek@ijs.si


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

Date: Thu, 22 May 1997 15:39:28 +0300
From: Daniel Schnaider <snaider@galcom.co.il>
Subject: From Unix Perl programming to NT Perl Programming... Help!
Message-Id: <33843E7F.9E400B7A@galcom.co.il>

Hello,

I a Unix Perl programmer.
I am trying to make a program in Perl for NT that send me mail after it
checks some things...
I dowloaded a program called postmail that suppose to send mail using
pipe.
It doesn't seem to work! If somebody know how can I send mail trough
PERL for NT or how to use this product... let me know

Thank you,

Daniel



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

Date: Fri, 23 May 1997 15:42:58 +0200
From: CAD-VISIOGRAPH <visiocad@easynet.fr>
Subject: get a file at a url PLEASE HELP!!!!
Message-Id: <33859EE2.E266C7A3@easynet.fr>

<HTML><BODY>
I want to open a file at an URL to print it on my PC with the command :
<BR>
<BR>open (toto,"&lt;http://URL/toto.txt"
<BR>@tableau = &lt;toto>
<BR>print toto
<BR>
<BR>it doesn't WORK !!!
<BR>
<BR>thanks

</BODY>
</HTML>


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

Date: 23 May 1997 04:49:46 -0500
From: jrobert1@guardian.cba.ua.edu (Jeff Robertson)
Subject: Re: getting next line in while
Message-Id: <5m3p7q$g8i@guardian.cba.ua.edu>

In article <5m0i8b$3nr$1@dartvax.dartmouth.edu>,
Chipmunk <Ronald.J.Kimball@dartmouth.edu> wrote:
>In article <5lsoe1$569$1@mark.ucdavis.edu>
>etfinley@ece.ucdavis.edu (Eric Finley) writes:
>
>> How can I get the next line of the file while in the while loop without going through the
>> next iteration of the while.  My code looks like:
>> 
>> while (<FILE>) {
>>     if (/foo/) {
>>         print;
>>     }
>>     if (/bar/) {
>>         print;
>>         get next line;
>>         print next line;
>
>print scalar(<FILE>);

But what if he also wants to check to see if that next line
contains /bar/ ? Maybe something like:

while (<FILE>) {
	if (/foo/) {
		print;
	}
	BAR: if (/bar/) {
		$_ = <FILE>;
		print;
		redo BAR;
	}
}

-- 
Jeff Robertson <jrobert1@midgard.cba.ua.edu>, <jroberts@sss.cba.ua.edu>
Consultant, Webmaster - System Support Services, C&BA, U of Alabama
Visit My Railroad Page: http://www.cba.ua.edu/~jrobert1/rail


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

Date: 23 May 1997 13:55:47 GMT
From: "Geoff Mottram" <minaret@sprynet.com>
Subject: Re: how do I format text
Message-Id: <01bc6780$c62c5440$aabaaec7@cactus>

> what I want to do is separate out the 9 fields and make them into a
> table. Then display the table..

If you are using tab characters or a fixed number of spaces to separate the
fields in the table, you can use split() easily enough to create an array
of elements for each line.  If not, you'll have to write some code to parse
each line into nine fields.

-- 
Geoff Mottram
minaret@sprynet.com


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

Date: Fri, 23 May 1997 14:16:49 GMT
From: joel@wmi0.wmi.com (Joel Coltoff)
Subject: Re: How to process logfiles with begin/end brackets?
Message-Id: <5m48ro$42n@netaxs.com>

In article <5m2dli$83p@winter.erols.com>,
Craig Schenk <murple@ares.bsg.erols.net> wrote:
>I have a process which sets up web space, email, etc, for domains. It returns
>a log with a format like:
>
>* =======
>* Command: eservice.com,eplee,No IPs,on,None,,PPP,Wildcard
>>>   Executing:ssh -l ns tool addrem eplee@eservice.com
>>>   Command returned: 0
>>>   >addrem: Done.
>* Command: Succeeded adding eservice.com
>* =======
>* Command: gvimail.com,gvmail,No IPs,on,None,,PPP,Dot
>>>   Executing:ssh -l ns tool addrem .@gvimail.com
>>>   Command returned: 0
>>>   >addrem: Done.
>* Command: Succeeded adding gvimail.com

I would start with something like this and if this is how I would
do it then there is a better more efficient way.

    while(<>)
    {

# linefeed is to keep lines short for news.
	$range =
	    /^\* Command:/ .. /^\* Command: Succeeded|^\* Command: Failed/;
	next if $range == 1;
	next if $range =~ /E0$/;
	print $_;
	{
	    # your code goes here.
	    # you can get the domain name when $range == 1
	}

    }

The line that sets $range could really be

	$range = /^\* Command:/ .. /^\* Command:/;

but my style is to have it match the logs in one-for-one fashion.

-- 
Joel Coltoff

I'd explain it, but there's a lot of math. -- Calvin


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

Date: 23 May 1997 12:22:20 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: How to use data files?
Message-Id: <5m425s$ol5$2@dartvax.dartmouth.edu>

In article
<Pine.SUN.3.95L.970521165729.26771A-100000@ahnnyong.cc.columbia.edu>
Cristian  Satnic <cs277@columbia.edu> writes:

> I have a file where on each line there is a string and a number such as
> 
> Furniture 23
> Bedroom 45
> 
> and so on.
> 
> I want to read this into an array and change the numbers based on
> comparisons on the strings. (the strings will be the keywords for
> comparisons and when I get a match I work with the number - an associative
> array).  How can I do this (read the file into the associative array)?

for (<FILE>) {
   my($key, $value) = split(/ /, $_, 2);
   $furniture{$key} = $value;
}

Chipmunk


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

Date: 23 May 1997 07:25:46 -0700
From: Randal Schwartz <merlyn@stonehenge.com>
To: ken@zadall.com (Ken Hargreaves)
Subject: Re: Looking for sh to perl convert program
Message-Id: <8cbu62w9hx.fsf@gadget.cscaper.com>

>>>>> "Ken" == Ken Hargreaves <ken@zadall.com> writes:

Ken> Is there any kind of utility to convert bourne shell scripts to
Ken> perl scripts?

"Any kind" could include "badly", so here's one:

    #!/usr/bin/perl
    print "#!/usr/bin/perl\n";
    print "system <<'UnLiKeLyStRiNg';\n";
    print <>;
    print "\nUnLiKeLyStRiNg\n";

:-)

But in short, no.

print "Just another Perl hacker," # but not what the media calls "hacker!" :-)
## legal fund: $20,495.69 collected, $182,159.85 spent; just 466 more days
## before I go to *prison* for 90 days; email fund@stonehenge.com for details

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@ora.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: 23 May 1997 11:26:08 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: mktemp for perl
Message-Id: <5m3usg$d9r@news-central.tiac.net>

In article <5m30hj$j0v@news-central.tiac.net>,
Mike Stok <mike@stok.co.uk> wrote:

>>Is there a perl version of the C call mktemp() in the core perl
>>distribution?  Or some module off of CPAN?
>
>
>  perl -MPOSIX -e 'print tmpnam'

Of course, 'mktmp' ne 'tmpnam'...

Sorry,

Mike

-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 23 May 1997 06:21:43 -0500
From: jrobert1@guardian.cba.ua.edu (Jeff Robertson)
Subject: Re: My keys are numbers...
Message-Id: <5m3uk7$gli@guardian.cba.ua.edu>

In article <33844996.3AA6@inorbit.com>,
christopher  <mrchristopher@inorbit.com> wrote:
>Hello again helpful people... 
>
>%um=(
>100	=>	[0,1000],
>20	=>	[1000,2000],
>30	=>	[1500,3000]);
>
>@bands=sort keys %um;
>foreach $band(@bands){print "$band :"}
>
>says:
>
>100 : 20 : 30
>
>I want it to say  20 : 30 : 100 (suprise suprise).  But so far I can't
>no matter how many times I read the FAQ etc etc. Could someone be so
>kind as to enlighten me please ?

Your problem is that sort will sort in lexical, not numeric, order
unless you tell it otherwise. The <=> operator does what you want.
Change that line with 'sort' in it to:

@bands = sort { $a <=> $b } keys %um; 

-- 
Jeff Robertson <jrobert1@midgard.cba.ua.edu>, <jroberts@sss.cba.ua.edu>
Consultant, Webmaster - System Support Services, C&BA, U of Alabama
Visit My Railroad Page: http://www.cba.ua.edu/~jrobert1/rail


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

Date: 23 May 1997 14:06:40 GMT
From: koos_pol@compuware.com (Koos Pol)
Subject: OS/2: Locales / I18N problem: What to do?
Message-Id: <5m489g$mdj@news.nl.compuware.com>


On my OS/2 Warp box, I get the following diagnostics on running programs. Who
can tell me what to do? I read the online manual, but didn't find any
pointers about how to approach this.

    perl: warning: Setting locale failed.
    perl: warning: Please check that your locale settings:
            LC_ALL = "ENUS437",
            LANG = "ENUS437"
        are supported and installed on your system.
    perl: warning: Falling back to the standard locale ("C").

Here are some config.sys settings:
    SET LANG=ENUS437
    SET I18NDIR=D:\IBMI18N
    SET LOCPATH=D:\IBMLAN\XPG4\LOCALE
    

Koos Pol
----------------------------------------------------------------------
                                                              S.C. Pol
                                              PC Systems Administrator
                                                 Compuware Europe B.V.
                         email: Koos_Pol@nl.compuware.com.NO_JUNK_MAIL


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

Date: 23 May 1997 05:16:55 -0500
From: jrobert1@guardian.cba.ua.edu (Jeff Robertson)
Subject: Re: parsing one line at a time problem.
Message-Id: <5m3qqn$gcq@guardian.cba.ua.edu>

In article <3383BB6A.4D21@wwide.com>, Scott  <Scott@wwide.com> wrote:
>Hi,
>
> I sent a message ealier and it was incorrect.. This is
>my problem:
>
>I have a text file that is space delimited.. I know, i know, 
>their is not suppose to be anything space delimited, but this
>file is.. my system creates it every day and I can not change that
>anyway, here is what it looks like:
>
>fred	928	333	181	tim	3838	3335	226	dc
>joe	282	gt	72	jsn	737	9292	929	98
>etc.

Have you read the description of split ?
Did you try something like:

while(<>) {

	@fields = split; # default delimiter for split is /\s+/
                         # default string to split is $_

	# now do whatever it is you want to do with the fields
}

-- 
Jeff Robertson <jrobert1@midgard.cba.ua.edu>, <jroberts@sss.cba.ua.edu>
Consultant, Webmaster - System Support Services, C&BA, U of Alabama
Visit My Railroad Page: http://www.cba.ua.edu/~jrobert1/rail
-----BEGIN GEEK CODE BLOCK-----


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

Date: 23 May 1997 12:47:13 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: parsing one line at a time problem.
Message-Id: <5m43kh$pc7$1@dartvax.dartmouth.edu>

In article <3383BB6A.4D21@wwide.com>
Scott <Scott@wwide.com> writes:

> fred    928     333     181     tim     3838    3335    226     dc
> joe     282     gt      72      jsn     737     9292    929     98
> etc.
> 
> This is not tab delimited.. just randomly formated.  I need to 
> do two things, one is read in each row and assign each field a name,
> then make each row into a table.  The second part will be easy once
> I can read in a row and assign each field a name.

for (<FILE>) {
  my($field1, $field2, $field3, $field4, $field5,
     $field6, $field7, $field8, $field9) = split(" ", $_, 9);
  # come up with your own meaningful names for the variables
}

Chipmunk


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

Date: Fri, 23 May 1997 11:26:26 GMT
From: ronolsen@lucent.com (Ron Olsen)
Subject: Re: Patch to Perl 5.004 for case-insensitive patterns (REFCASE1)
Message-Id: <EAMt43.7qD@drnews.dr.lucent.com>

jam@philabs.research.philips.com wrote:
> 
> The patch was bombing for me too.  I noticed that this looks like it patched
> only one file, but the patch I got is supposed to patch 3 different files.
> Are you sure it worked as expected?

The problem is the patch has two lines that extend beyond
column 80, and bogus newlines were inserted.
Edit the patch and join the lines containing "#define WHILEM ..." with
the following line.

The following version worked for me, after I made the above changes.

-- 
	Ron Olsen
	ronolsen@lucent.com
	Boulder Colorado

-------------------------
Index: patchlevel.h
***************
*** 41,42 ****
--- 41,43 ----
+ 	,"REFCASE1 - fix for case-insensitivity in regex backreferences"
  	,NULL
  };

Index: regcomp.h
***************
*** 73,95 ****
  #define NBOUND	22	/* no	Match "" at any word non-boundary */
  #define NBOUNDL	23	/* no	Match "" at any word non-boundary */
! #define REF	24	/* num	Match some already matched string */
! #define	OPEN	25	/* num	Mark this point in input as start of #n. */
! #define	CLOSE	26	/* num	Analogous to OPEN. */
! #define MINMOD	27	/* no	Next operator is not greedy. */
! #define GPOS	28	/* no	Matches where last m//g left off. */
! #define IFMATCH	29	/* no	Succeeds if the following matches. */
! #define UNLESSM	30	/* no	Fails if the following matches. */
! #define SUCCEED	31	/* no	Return from a subroutine, basically. */
! #define WHILEM	32	/* no	Do curly processing and see if rest matches. */
! #define ALNUM	33	/* no	Match any alphanumeric character */
! #define ALNUML	34 	/* no	Match any alphanumeric char in locale */
! #define NALNUM	35	/* no	Match any non-alphanumeric character */
! #define NALNUML	36	/* no	Match any non-alphanumeric char in locale */
! #define SPACE	37	/* no	Match any whitespace character */
! #define SPACEL	38	/* no	Match any whitespace char in locale */
! #define NSPACE	39	/* no	Match any non-whitespace character */
! #define NSPACEL	40	/* no	Match any non-whitespace char in locale */
! #define DIGIT	41	/* no	Match any numeric character */
! #define NDIGIT	42	/* no	Match any non-numeric character */
  
  /*
--- 73,97 ----
  #define NBOUND	22	/* no	Match "" at any word non-boundary */
  #define NBOUNDL	23	/* no	Match "" at any word non-boundary */
! #define REF	24	/* num	Match already matched string */
! #define REFF	25	/* num	Match already matched string, folded */
! #define REFFL	26	/* num	Match already matched string, folded in loc. */
! #define	OPEN	27	/* num	Mark this point in input as start of #n. */
! #define	CLOSE	28	/* num	Analogous to OPEN. */
! #define MINMOD	29	/* no	Next operator is not greedy. */
! #define GPOS	30	/* no	Matches where last m//g left off. */
! #define IFMATCH	31	/* no	Succeeds if the following matches. */
! #define UNLESSM	32	/* no	Fails if the following matches. */
! #define SUCCEED	33	/* no	Return from a subroutine, basically. */
! #define WHILEM	34	/* no	Do curly processing and see if rest matches. */
! #define ALNUM	35	/* no	Match any alphanumeric character */
! #define ALNUML	36 	/* no	Match any alphanumeric char in locale */
! #define NALNUM	37	/* no	Match any non-alphanumeric character */
! #define NALNUML	38	/* no	Match any non-alphanumeric char in locale */
! #define SPACE	39	/* no	Match any whitespace character */
! #define SPACEL	40	/* no	Match any whitespace char in locale */
! #define NSPACE	41	/* no	Match any non-whitespace character */
! #define NSPACEL	42	/* no	Match any non-whitespace char in locale */
! #define DIGIT	43	/* no	Match any numeric character */
! #define NDIGIT	44	/* no	Match any non-numeric character */
  
  /*
***************
*** 122,126 ****
      /*CURLY*/ 4, /*CURLYX*/ 4,
      0,0,0,0,0,0,0,0,0,0,0,0,
!     /*REF*/ 2, /*OPEN*/ 2, /*CLOSE*/ 2,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  };
--- 124,128 ----
      /*CURLY*/ 4, /*CURLYX*/ 4,
      0,0,0,0,0,0,0,0,0,0,0,0,
!     /*REF*/ 2, 2, 2, /*OPEN*/ 2, /*CLOSE*/ 2,
      0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
  };
***************
*** 156,159 ****
--- 158,163 ----
  	NBOUND,
  	REF,
+ 	REF,
+ 	REF,
  	OPEN,
  	CLOSE,
***************
*** 182,186 ****
  #else
  EXT char varies[] = {
!     BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, WHILEM, 0
  };
  #endif
--- 186,190 ----
  #else
  EXT char varies[] = {
!     BRANCH, BACK, STAR, PLUS, CURLY, CURLYX, REF, REFF, REFFL, WHILEM, 0
  };
  #endif

Index: regcomp.c
*************** tryagain:
*** 904,908 ****
  		else {
  		    regsawback = 1;
! 		    ret = reganode(REF, num);
  		    *flagp |= HASWIDTH;
  		    while (isDIGIT(*regparse))
--- 904,910 ----
  		else {
  		    regsawback = 1;
! 		    ret = reganode((regflags & PMf_FOLD)
! 				   ? ((regflags & PMf_LOCALE) ? REFFL : REFF)
! 				   : REF, num);
  		    *flagp |= HASWIDTH;
  		    while (isDIGIT(*regparse))
*************** char *op;
*** 1667,1670 ****
--- 1669,1678 ----
      case REF:
  	sv_catpvf(sv, "REF%d", ARG1(op));
+ 	break;
+     case REFF:
+ 	sv_catpvf(sv, "REFF%d", ARG1(op));
+ 	break;
+     case REFFL:
+ 	sv_catpvf(sv, "REFFL%d", ARG1(op));
  	break;
      case OPEN:

Index: regexec.c
*************** char *prog;
*** 826,830 ****
--- 826,834 ----
  	    nextchar = UCHARAT(++locinput);
  	    break;
+ 	case REFFL:
+ 	    regtainted = TRUE;
+ 	    /* FALL THROUGH */
  	case REF:
+ 	case REFF:
  	    n = ARG1(scan);  /* which paren pair */
  	    s = regstartp[n];
*************** char *prog;
*** 836,845 ****
  		break;
  	    /* Inline the first character, for speed. */
! 	    if (UCHARAT(s) != nextchar)
  		sayNO;
  	    ln = regendp[n] - s;
  	    if (locinput + ln > regeol)
  		sayNO;
! 	    if (ln > 1 && memNE(s, locinput, ln))
  		sayNO;
  	    locinput += ln;
--- 840,856 ----
  		break;
  	    /* Inline the first character, for speed. */
! 	    if (UCHARAT(s) != nextchar &&
! 		(OP(scan) == REF ||
! 		 (UCHARAT(s) != ((OP(scan) == REFF
! 				 ? fold : fold_locale)[nextchar]))))
  		sayNO;
  	    ln = regendp[n] - s;
  	    if (locinput + ln > regeol)
  		sayNO;
! 	    if (ln > 1 && (OP(scan) == REF
! 			   ? memNE(s, locinput, ln)
! 			   : (OP(scan) == REFF
! 			      ? ibcmp(s, locinput, ln)
! 			      : ibcmp_locale(s, locinput, ln))))
  		sayNO;
  	    locinput += ln;


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

Date: 22 May 1997 22:16:15 GMT
From: nelsonp@news.dct.com (Philip Nelson)
Subject: Re: PERL SCRIPT FOR PASSOWRD
Message-Id: <5m2gjf$2dk$1@gbol.dct.com>

Michael Lammon (Michael.C.Lammon@mci.com) wrote:
: All,
: 
: 	Does anyone have a PERL program which will call the User Name:
: Password:
: feature for a Netscape Browser or IE? and upon correct password that
: will allow
: a user to go to the html file??
: 
: Thanks
: 
: Mike

check out http://www.dct.com/~nelsonp/IISHeader.html for some background. 
A unix server will not be much different in this regard.

-- 
Philip Nelson
Consultant, Guitarist, etc.
nelsonp@online.dct.com



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

Date: 23 May 1997 07:54:44 GMT
From: "Carl K. Cunningham" <ccu@sbk-ks.de>
Subject: Re: PerlNT/95 gethostbyname
Message-Id: <01bc6756$7fcb2780$490e10c1@opal.sbk-ks.de>

Hmmmm, the DNS Adress is correct here, but we don't use/have a WINS Server
here. Could it be that Perl waits for a timeout from a non-existant WINS
server, and if so, how can I change this? We took a look at the network
activity while PerlNT/95 was doing DNS resolver work, and indeed, my
workstation kept trying to contact the various IP adresses on the
netbios-nb port. Bizarre.
-- 
Carl K. Cunningham
SBK Software + Systeme GmbH
Hollaendische Strasse 141
34127 Kassel
Germany
Tel: (+49) 561 9899 754
Fax: (+49) 561 851 61


Jeff Stampes <stampes@xilinx.com> schrieb im Beitrag
<5m1s5i$f4c$2@neocad.com>...
> Carl K. Cunningham (ccu@sbk-ks.de) wrote:
> : I'm using Perl95/NT version 5.003_07 and I've noticed that
"gethostbyname"
> : lookups are painfully slow. Any particular reason why?
> 
> Mine were painfully slow as well...it turns out I was poitning at
> the wrong DNS and WINS servers...they were valid on the network,
> but were waaaaayayyy off in never-never land.  When I got the correct
> server IPs from my Admin and made the changes, it made the lookups
> a LOT faster.
> 
> HTH
> 
> jeff 
> 
> 
> --
> Jeff Stampes -- Xilinx, Inc. -- Boulder, CO -- jeff.stampes@xilinx.com
> 


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

Date: 23 May 1997 12:14:18 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: printing 2 dimentinal Hash table
Message-Id: <5m41mq$ol5$1@dartvax.dartmouth.edu>

In article <3381AF30.A5E@iil.intel.com>
Allon Henig <ahenig@iil.intel.com> writes:

>         how is it possible to print each value of a 2 dimentional Hash table ?
> It Should be something like:
>         
> foreach $key (keys %HashTable) {
>         ...do something..
>         }
> 
> but this is a >>2<< dimentional HT?!

By two-dimensional hash table, I assume you mean each value is a
reference to an array of two elements.  Is that the case?

foreach $key (keys %HashTable) {
    @val = @{ $HashTable{$key} };
    print "$key = (", join(", ", @val), ")\n";
}

Chipmunk


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

Date: Fri, 23 May 1997 14:23:50 GMT
From: jader@rsabbs.com (jader@rsabbs.com)
Subject: Re: Private area using Perl/CGI
Message-Id: <3385a7b4.6948271@207.103.140.10>

On Tue, 13 May 1997 22:18:14 +0200, Ketil Froyn <ketilf@ifi.uio.no> wrote:

>Does anyone know how to make a section of web-pages that needs a
>password to access? If so, would you like to share your knowledge with
>me? :)
>
>Ketil

You don't need to set up a perl/cgi script to limit directories. If you run any NCSA HTTPd server then there are certain
steps you can take to password protect directories..

goto http://hoohoo.ncsa.uiuc.edu/docs/tutorials/user.html

and it will tell you how to set it up.



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

Date: 23 May 1997 11:44:01 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Problem with anonymous array as instance variable?
Message-Id: <5m3vu1$e5p@news-central.tiac.net>

In article <5m32lf$lmd@sun20.ccd.bnl.gov>, Mark Doyle <doyle@aps.org> wrote:
>Hi all,
>
>I can't quite figure out why this doesn't work the way I expect it to. 
>Perhaps it is a perl bug, but presumably it is more likely that I have a 
>simple misunderstanding. Below is a simple program that creates two Foo 
>objects and then prints them out. One of the instance variables is 
>initialized as an anonymous array while the other is just a scalar. The 
>program sets some values for these instance variables for each object and 
>then simply prints the two objects out.
>
>So what's the problem? I would have thought each instance of Foo would have 
>had its own hash %ivar, but it seems that the same array is used for both 
>objects while different scalars are used. So instead of getting output that 
>looks like

The problem is that your %ivars hash has 2 key / value pairs

  hometown - an undefined scalar
  characters - a scalar containing a pointer to an anon list

when you do

  my $self = {%ivars};

in the constructor then you get an anonymous copy of %ivars, but the value
associated with the characters key is a copy of the scalar in the "real"
%ivars, which happens to be a reference to the anonymous array that's
already instantiated. 

Setting up %ivars as

  %ivars = (hometown   => undef,
            characters => undef,
           );

will force the allocation of a new anonymous array when add_character
tries to do a push onto the object's characters element.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@psa.pencom.com                |      Pencom Systems Administration (work)


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

Date: 23 May 1997 04:55:25 -0700
From: neilson@skat.usc.edu (D. Alex Neilson)
Subject: Problem: Installing Perl 5.004 on irix 6.4
Message-Id: <5m40jd$fhu$1@skat.usc.edu>
Keywords: perl5.004 irix6.4


I'm trying to install perl 5.004, uname -a

	IRIX64 hyperion 6.4 02121744 IP27

use all the defaults, and I seem to get most of the way, and then get

  Running Mkbootstrap for DB_File ()
        chmod 644 DB_File.bs
        LD_RUN_PATH="/usr/local/lib" ld -o ../../lib/auto/DB_File/DB_File.so
  -n32 -shared -L/usr/local/lib -L/usr/lib32 -L/lib32 DB_File.o
  -L/usr/local/lib -ldb 
  ld: FATAL 112: cannot link old 32-bit object with -n32 link:
  /usr/local/lib/libdb.a(db.o).
  *** Error code 4 (bu21)
  *** Error code 1 (bu21)


Any pointers would be appreciated.


Thanks,

Alex <Neilson@usc.edu>


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

Date: 23 May 1997 15:55:29 +0300
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: Problem: Installing Perl 5.004 on irix 6.4
Message-Id: <oeepvuiuz3y.fsf@alpha.hut.fi>


:  ld: FATAL 112: cannot link old 32-bit object with -n32 link:
:  /usr/local/lib/libdb.a(db.o).

The problem is that you are trying to use too a libdb linked in
the old, no-more-to-used, way with Perl that linked in the new way.

I suggest you recompile your libdb with cc -n32.  (The other way
would be to reconfigure Perl not to use Berkeley DB but then you
lose the possibility to use Berkeley DB within Perl)

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


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

Date: 23 May 1997 13:40:16 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Reading info from animated gif
Message-Id: <5m46o0$sc1@fridge-nf0.shore.net>

Hans Kind (hans@kindserver.com) wrote:

: I'm looking for a cgi/perl routine that can read the info like pixel
: size, comment tag etc, stored within a animated gif, in a way that can
: be used to display this on a html page. Anyone out here that can help
: me out?

Look into Image::PerlMagick, based on the ImageMagick package, available
at a CPAN near you!

--
Nathan V. Patwardhan
nvp@shore.net



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

Date: Fri, 23 May 1997 10:03:40 -0400
From: EScrubb@worldnet.att.net (Cornelius Griffin)
Subject: Re: RegExp tutorial suggestions?
Message-Id: <MPG.def6dc95206efd598968d@netnews.worldnet.att.net>

In article <3384E9F9.521D078C@psu.edu>, jsoloff@psu.edu says...
> Hi all..
> 
> Does anyone know of a good regexp tutorial or FAQ online?  
> Doesn't have to be incredibly perl heavy, just explain how to
> set up and use the regexps...
> 
> Thanks,
> 
> Jason
> 
Jason,
	Don't know of any online, however, Jeff Friedel wrote an awesome 
book "Mastering Regular Expressions".
Cornelius


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

Date: 23 May 97 11:32:06 GMT
From: "Geoffrey Shuetrim" <G.Shuetrim@lse.ac.uk>
Subject: Server side includes to run Perl scripts from web pages
Message-Id: <01bc676c$36be47a0$1c628f9e@IBM9772.LSE>

Hello,

I hope this is the right place to post this question.  If not please
redirect me.

I am trying to execute a Perl script to generate a counter on my web page
using the following comment tag in the webpage itself.

<!--#exec cgi="http://cep.lse.ac.uk/fm-cgi-bin/counter.pl"-->

Where counter.pl is the script I wish to execute and fm-cgi-bin is the
virtual location from which I am able to execute such scripts.  (I am able
to execute scripts from this location when using forms so I do not think
the problem is coming from the setup of the location of the script.)

When the webpage comes up on my browser, instead of a counter, I get the
message:

[an error occurred while processing this directive] 

Server side includes are enabled on our server to do this (in theory) by
adding the following to the /usr/local/etc/httpd/conf/srm.conf file:

AddType text/x-server-parsed-html .shtml
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm

AddType application/x-httpd-cgi .cgi
AddType application/x-httpd-cgi .pl

You can see the error message at:

http://cep.lse.ac.uk/fmg/people/shuetrim/index.html at the bottom of the
page.

Any suggestions as to what is going wrong and what can be done about it
would be much appreciated,

-- 
Geoffrey Shuetrim
G.Shuetrim@lse.ac.uk


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

Date: Fri, 23 May 1997 12:00:45 +0200
From: Michel de Groot <grootr@cs.utwente.nl>
Subject: Re: Strings as a uniform representation & tcl
Message-Id: <33856ACD.4B9C@cs.utwente.nl>

Olin Shivers wrote:
> 
>     >     If one had to choose a single type for everything, a string is a
>     > pretty good choice.   Why not a number?  How would you represent a
>     > string with a number?

Like a computer does: using a bit string. Much more efficient than a
ascii string anyway (which ofcourse is a bit string, I know).

Michel de Groot


> 
> Perlis, as usual, summed it up well in one of his aphorisms:
> 
>     The string is a stark data structure, and everywhere it
>     occurs there is much hiding of information.
> 
> This is what is wrong with both Unix and tcl. Their power is also a great
> weakness: they are designed around a "least common denominator"
> representation, strings. What it buys you is that everything interoperates.
> The above aphorism explains what it costs you.
>     -Olin

-- 
Freddy's Law: Murphy was an optimist

Visit the Ducosim website at
www.euronet.nl/~ducosim

R.M. de Groot
Campuslaan 57-104
7522 NK Enschede
the Netherlands
tel. NL-053-4895100 (home)
     NL-053-4894179 (work)
email: r.m.degroot@student.utwente.nl (home)
       grootr@cs.utwente.nl (work)


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

Date: 23 May 1997 13:13:20 GMT
From: Ronald.J.Kimball@dartmouth.edu (Chipmunk)
Subject: Re: timelocal.pl ?
Message-Id: <5m455g$pc7$2@dartvax.dartmouth.edu>

In article <strider-ya02408000R2005971558080001@news.winternet.com>
strider@ShadowMAC.org (Raul Almquist) writes:

> #!/usr/local/bin/perl5
> 
> use Time::Local;
> 
> $time = timelocal($sec,$min,$hours,$mday,$mon,$year);
> 
> print $time;
> 
> and below is what I get when I run the script...
> 
> "Day out of range 1..31 in timelocal.pl at testing.pl line 5"
> 
> 
>   What the heck is going on here?!?  how could it be out of range?

Well, if that's your whole script, you've never set $mday, so $mday is
0, which is not in the range 1..31.

If that's not your whole script, perhaps you should show us the whole
thing.

Chipmunk


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

Date: Fri, 23 May 1997 12:45:27 +0200
From: Andy James Shaw <chp95ajs@sheffield.ac.uk>
Subject: Re: winnuke
Message-Id: <33857547.41C6@sheffield.ac.uk>

Magnus Bodin wrote:
> As stated:
> 
> Here is the source code, in PERL. I took one crucial line out, and
> made a typo, which will be obvious to anyone who uses PERL, so as to
> limit it's usefulness only to knowledgable people. This should run
> under all UNIX's as well as Windows 95.

I'm not 'knowledgeable' yet (although I can spell it :p ) and I would be
grateful if someone would point out the typo in Zack's code. I've stared
at it for a while now, and can't make up my mind if there should be a do
{block;} after the die or if the comma between S and "sucker" in send
needs removing. Maybe it's neither of these, but I'd rather learn by
someone else's mistakes than my own...


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

Date: 23 May 1997 09:06:47 -0400
From: allen@gateway.grumman.com (John L. Allen)
Subject: Re: yet another perl regex Q
Message-Id: <5m44p7$9jl@gateway.grumman.com>

In article <EALHoq.ABI@nonexistent.com>, Abigail <abigail@fnx.com> wrote:
>On 22 May 1997 15:21:36 GMT, felix k sheng (felix@chance.em.nytimes.com)
>wrote in comp.lang.perl.misc
><URL: news:slrn5o8peq.bfc.felix@chance.em.nytimes.com>:
>++ On 22 May 1997 11:05:36 -0400, John L. Allen <allen@gateway.grumman.com>
>++ wrote:
>++ >I know this is probably explained in the Hip Owls book somewhere, but
>++ >I don't have it handy, so please suffer my ignorance.  Why doesn't
>++ >either of the following replace the *last* three blanks in $_ with 'bar'?
>++ >
>++ >	perl -e '$_="foo      xxx"; s/ {3}(?=.*)$/bar/; print'
>++ >	perl -e '$_="foo      xxx"; s/ {3}(?=.*?)$/bar/; print'
>++ 
>++ you could use this:
>++ perl -e '$_="foo      xxx"; s/ {3}(?=\S*$)/bar/; print'
[...]
>
>That will fail if there is whitespace after the last 3 spaces.
>What you want is to replace 3 spaces not followed 3 spaces.
>
>$ perl -wle '$_ = "123     45 67"; s/ {3}(?!.* {3})(?! )/XXX/; print;'
>123  XXX45 67

This is meaningless coming from me, I know, but "Brilliant!"

So this says 'find 3 spaces that aren't followed by 3 spaces anywhere in
the remainder of the string _AND_ that aren't immediately followed by a
space'.  And this is exactly the same as 'find the _last_ three spaces in
the string'!  Cool.

I had gotten this far a while after my post

	perl -wle '$_ = "123   45      67"; s/ {3}(?!.* {3})/XXX/; print;'
	123   45 XXX  67

but this will allow matching 3 spaces followed by less than 3 spaces.  I
couldn't figure out that I needed that trailing (?! ).

Thanks to all who responded.

John.


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

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

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