[7521] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1148 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 8 23:07:14 1997

Date: Wed, 8 Oct 97 20:00:22 -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           Wed, 8 Oct 1997     Volume: 8 Number: 1148

Today's topics:
     Adv Perl Prog Tutorial - Boulder, CO (John Donnelly)
     Re: Determining if function exists in class (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Does Perl compile to bytecode internally?? (Eric)
     Re: Does Perl compile to bytecode internally?? <bholzman@mail.earthlink.net>
     Re: Download site for NT version of Perl <ase@seanet.com>
     Re: E-mail a WWW file (Jeremy Brinkley)
     Re: Forcing numeric interpretation? (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
     Re: generating javascript <joneil@cks.ssd.k12.wa.us>
     Re: Help with regular expressions! (Eric)
     Lame Question re; pod2man <pdenman@ims.ltd.uk>
     manifest.pm <acouch@activevoice.com>
     mkdir problems <Barry@exclaim.demon.co.uk>
     Re: mkdir problems <bholzman@mail.earthlink.net>
     Re: mkdir problems (Tad McClellan)
     Need help with logic dwhill@atl.mindspring.com
     Re: Need To Clear Screen With Perl 5...? <bholzman@mail.earthlink.net>
     needed: date stamp of a graphic file being loaded into  <dmiller@region.net>
     Re: needed: date stamp of a graphic file being loaded i (brian d foy)
     Perl 5.004_03 and Time::HiRes not compatible? <chris@ixlabs.com>
     Please help! (P Chappell)
     Re: Problem with script in LLama book (brian d foy)
     Re: Problem with script in LLama book (Tad McClellan)
     Q: hash key confusion (Raymond Yee)
     Re: Q:perl beautifier? <rpsavage@ozemail.com.au>
     Re: Syntax (brian d foy)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 8 Oct 1997 12:39:54 -0600
From: johnd@xor.com (John Donnelly)
Subject: Adv Perl Prog Tutorial - Boulder, CO
Message-Id: <61gk1q$hcd@xor.com>

The following tutorial is being presented at our training facility in
Boulder, CO.  For further information, registration form contact:
--John Donnelly, Training Coordinator
  XOR Network Engineering, Inc.
  http://www.xor.com/tt  johnd@xor.com  303-448-4816
				*****
                     Advanced Perl Programming
                  (Three Day Hands-on Lecture/Lab)
                    	  Presented By
                    	Tom Christiansen
		Tuesday - Thursday, October 14-16, 1997
			Tuition: $995

    This course presents everything you'll  need  to  completely
    master  advanced Perl programming using features and facili-
    ties from the latest release of Perl (5.004).

    Who should attend:
    Anyone interested in honing their existing Perl  programming
    skills  for  quick  prototyping,  system utilities, software
    tools, system management tasks, database access,  and  world
    wide web programming.

    Prerequisites:
    Besides having already taken a course in beginning Perl pro-
    gramming  or  having  read  the  Learning  Perl  book  from
    O'Reilly, students should also have already  used  Perl  for
    basic  scripting  for several months previous to taking this
    course.  Basic screen editing and manipulating of files on a
    Unix system are also assumed.


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

Date: Wed, 08 Oct 97 17:47:29 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Determining if function exists in class
Message-Id: <343c0006$1$ofn$mr2ice@speaker>

In <01bcd2ef$6d32e540$df55f5cf@splichta>, on 10/07/97 at 07,
   "Scott Plichta" <splichta@endeavortech.com> said:
+-----
| Can I say:
| $foo = 'method1';
| &{$self}->$foo()  if (defined(&{$self->$foo}));
+--->8

No, but you can say "$self->can($foo)"; and it will check for inherited
methods.  Check "perldoc perlobj" for more information.

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: 8 Oct 1997 22:34:46 GMT
From: pojo@gte.net (Eric)
Subject: Does Perl compile to bytecode internally??
Message-Id: <61h1q6$i8n$1@gte1.gte.net>


I have a few questions:

Does PERL compile a program to bytecode internally before executing?  

If so:

Does it compile all included modules (PMs) that are specified?  --
meaning is the compiled code ready to run without referring to any
other files other than the PERL interpreter itself?

Can this bytecode be exported?  

Can it be run by a "barebones" perl interpreter? (no PM files)

I have read the FAQ's, and have done my searching in DejaNews &
lurking on the newsgroup, but can't really answer these questions
satisfactorily.  I guess my mind is stuck in the old token-ized BASIC
paradigm.

-- Eric


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

Date: Wed, 08 Oct 1997 20:50:36 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Eric <pojo@gte.net>
Subject: Re: Does Perl compile to bytecode internally??
Message-Id: <343C2A5C.B31B2A7D@mail.earthlink.net>

[posted & mailed]

Eric wrote:
> 
> I have a few questions:
> 
> Does PERL compile a program to bytecode internally before executing?
Perl compiles a program to a 'syntax tree', not a bytecode per se, but
still a discrete 'compilation' step. 
> 
> If so:
> 
> Does it compile all included modules (PMs) that are specified?  --
> meaning is the compiled code ready to run without referring to any
> other files other than the PERL interpreter itself?

Yes, with the important caveat that AUTOLOAD()ed subroutines will not be
compiled.

> 
> Can this bytecode be exported?

All kinds of interesting things can be done with the output of the
compilation phase.  Check out Malcolm Beattie's Perl compiler, which
should be much improved in perl 5.005, as I understand it.

> 
> Can it be run by a "barebones" perl interpreter? (no PM files)

The problem you'll run into is AUTOLOAD()ed subroutines.

> 
> I have read the FAQ's, and have done my searching in DejaNews &
> lurking on the newsgroup, but can't really answer these questions
> satisfactorily.  I guess my mind is stuck in the old token-ized BASIC
> paradigm.
> 
> -- Eric

Hope this helps!

Benjamin Holzman




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

Date: Wed, 8 Oct 1997 18:22:54 -0700
From: "Allen Evenson" <ase@seanet.com>
Subject: Re: Download site for NT version of Perl
Message-Id: <61hbks$elv@q.seanet.com>

Winzip 6.1 will open .gz and .tar files easily... I do it all the time.

HTH

Allen E.

Jeff Girard wrote in article =
<01bcd430$fe7aa320$78da1b8a@girardj.army.mil>...

>The www.perl.com only has the download in latest.tar.gz format.  Can
>someone please point me to a source for Perl (preferably the latest
>version) in Winzip format?
>
>Jeff



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

Date: 9 Oct 1997 00:35:58 GMT
From: jeremy@wishbone.stanford.edu (Jeremy Brinkley)
Subject: Re: E-mail a WWW file
Message-Id: <61h8te$8m7$1@nntp.Stanford.EDU>

On 8 Oct 1997 02:18:48 GMT, Liam Bateman (liam@dircon.co.uk) put forth:
> 
> 	I'm just learning PERL and was wondering whether anyone could help me do
> the following:
> 
> Every sunday morning my logs are created, by analog, for my WWW sites,
> is it possible to 'hack' a PERL script to run every, sunday lunch time

Yes, it is possible.  Although instead of 'hack'-ing you may want to
'write' and 'schedule' such a script.

> (ish), say, and then perform this command line action on it:
> 
> 'proclog wwwlog.html resolved_log.html'
> 
> then E-mail  'resolved.html' to my E-mail address,

I assume you mean resolved_log.html?

> from what little I know i s'pos I need to use cron ?
> and use the 'sendmail' program but I do not know how!

I'm assuming you are using a Unix system from the fact that you want
to use cron and sendmail.  In that case, there's another command
that may be helpful to you: man.  Type 'man sendmail' and 'man cron'
from a shell prompt and you will get a start on how to use them.

If all you want is to archive wwwlog.html and mail it to yourself, you
may not want to write a perl script, but just schedule the appropriate
shell commands.  The 'mv', 'mail' and 'rm' commands might be helpful.

-- 
  Jeremy Brinkley                      jeremy@wishbone.stanford.edu
  System Administrator                 finger for PGP key (2.6.2) or
  Stanford Blood Center                http://wishbone.stanford.edu/~jeremy


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

Date: Wed, 08 Oct 97 17:50:43 -0400
From: bsa@void.apk.net (Brandon S. Allbery KF8NH; to reply, change "void" to "kf8nh")
Subject: Re: Forcing numeric interpretation?
Message-Id: <343c011f$2$ofn$mr2ice@speaker>

In <343bb067$1$fnzqvr$mr2ice@news-s01.ny.us.ibm.net>, on 10/08/97 at 11,
   samdie@ibm.net said:
+-----
| Is there a way to force perl to store fields obtained by reading a file as
| numbers? For example, if I were to read a table of state abbreviations and
+--->8

Not really; Perl works with strings.  You can give Perl a hint that you're
working with a numeric value by adding 0 to the value in question, but it's
still a string when all is said and done.  (Perl can use the "hint" to
optimize some things, although I don't know how much such optimization
actually happens.)

-- 
brandon s. allbery              [Team OS/2][Linux]          bsa@void.apk.net
cleveland, ohio              mr/2 ice's "rfc guru" :-)                 KF8NH
Warpstock '97:  OS/2 for the rest of us!  http://www.warpstock.org
Memo to MLS:  End The Burn Scam --- Doug Logan MUST GO!  FORZA CREW!



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

Date: Wed, 08 Oct 1997 16:04:42 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: Mark Wilhelm <mwilhelm@astro.temple.edu>
Subject: Re: generating javascript
Message-Id: <343C118A.A889B4F3@cks.ssd.k12.wa.us>

Use "HERE" documents whenever possible.

Also, don't use double and single quotes.  Use q and qq instead.

Example:
/#!usr/bin/perl
$foo = 'This isn\'t interpolated';
print "onClick=myFunction(\"$foo\")";

Should be:
#!/usr/bin/perl
$foo =q{This isn't interpolated};
print qq{onClick=myFunction("$foo")};


Makes life much easier.

Good Luck!

Jerome
Mark Wilhelm wrote:

> I'm having some problems using perl to generate javascript.  I think the
> biggest obstacle is how to handle/escape the javascript code brackets so
> that perl doesn't interpret them as perl code.  Anyone have any
> ideas/subroutines I can "creatively plagiarize" (read: steal)?





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

Date: 8 Oct 1997 23:50:35 GMT
From: pojo@gte.net (Eric)
Subject: Re: Help with regular expressions!
Message-Id: <61h68b$r22$1@gte1.gte.net>

On Sat, 27 Sep 1997 09:01:34 GMT, ben.glazer@mail.utexas.edu (Ben
Glazer) wrote:

>Hello, all!
>
>i'm trying to write a short perl script to convert HTML tags to
>lowercase except inside of quote marks, e.g.
>
>	<IMG SRC="/images/lwall.jpg" ALt="Larry!">
>
>should be translated to
>
>	<img src="/images/lwall.jpg" alt="Larry!">
>
>see?  easy, right?
>
>okay, well this is what i have:
>
>while (<>) {
>   s/(.*?<)(.*?)(".*?")(.*>)/$1\L$2\E$3\L$4>/g;
>}
>
>and this is very nice when you have exactly one pair of quote marks.
>otherwise, it bites.  is there any way to have the regexp skip over a
>variable number of quoted strings?

I have 2 scripts that I wrote called 'rip.pl' and 'build.pl', which
rip apart and re-build HTML files, respectively.  I specifically wrote
them so that tag names and attributes (i.e img, src, alt) are
automatically converted to uppercase.  This is easily modifiable to do
lowercase instead.  
	
These scripts can handle entire directory trees of HTML files, and
create only 2 intermediate files from 10, 100, or even 1000 HTML
files, then re-build these files to either the same, or another
directory.  In the interim, you could write your own script to
automatically add WIDTH and HEIGHT attributes to all images (for
example)

Contact me if you would like the scripts.

pojo@gte.net
-- Eric


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

Date: Wed, 8 Oct 1997 12:11:31 +0100
From: "Paul Denman" <pdenman@ims.ltd.uk>
Subject: Lame Question re; pod2man
Message-Id: <1qpf16.fkj.ln@gate.imsport.co.uk>

Hello,

I've often read of the utilities 'pod2man' and 'pod2html' which are meant
to come with Perl. However, my web server which has Perl v5.001,
unofficial patchlevel 1m, does not seem to have these two utilities
installed.

Is there anywhere I could download just these two files from, and where
should I install them on my server?

Perl5 is currently installed in:

/usr/local/bin

with the libraries in:

/usr/local/lib/perl5

Any help would be appreciated.

Cheers,

Paul Denman




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

Date: 9 Oct 1997 01:22:37 GMT
From: "Aaron Couch" <acouch@activevoice.com>
Subject: manifest.pm
Message-Id: <01bcd451$82f735d0$491dd8ce@sea-ws0093>

does anyone know specifically where to find this file???
i can't find it anywhere.

AC


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

Date: Wed, 08 Oct 1997 22:37:58 GMT
From: "Barry Neville" <Barry@exclaim.demon.co.uk>
Subject: mkdir problems
Message-Id: <01bcd43b$0876e5a0$7f6fdec2@exclaim.demon.co.uk>

I'm getting some crazy results from the Perl mkdir function running on a
Solaris 2.5 machine. The resulting permissions I'm getting seem almost
random. Can anyone shed some light?

Thanks.


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

Date: Wed, 08 Oct 1997 20:51:50 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Barry Neville <Barry@exclaim.demon.co.uk>
Subject: Re: mkdir problems
Message-Id: <343C2AA6.CE3F9347@mail.earthlink.net>

[posted & mailed]

Barry Neville wrote:
> 
> I'm getting some crazy results from the Perl mkdir function running on a
> Solaris 2.5 machine. The resulting permissions I'm getting seem almost
> random. Can anyone shed some light?
> 
> Thanks.

If you post your code, I'm sure some of the able and willing experts who
prowl this group will be happy to help you out :-)

Benjamin Holzman



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

Date: Wed, 8 Oct 1997 20:45:13 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: mkdir problems
Message-Id: <9vch16.ki.ln@localhost>

Barry Neville (Barry@exclaim.demon.co.uk) wrote:
: I'm getting some crazy results from the Perl mkdir function running on a
: Solaris 2.5 machine. The resulting permissions I'm getting seem almost
: random. Can anyone shed some light?


Can't fix broken code that we cannot see.

Kinda strange to think that we could too.

If you need help with broken code, you should consider posting
said broken code ;-)



But anyway, you do have leading zeros on the MODE argument so that
they will be interpreted as octal, right?


0755 != 755 ...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: Wed, 08 Oct 1997 06:57:41 GMT
From: dwhill@atl.mindspring.com
Subject: Need help with logic
Message-Id: <61hg39$6t5@camel15.mindspring.com>


    Never said I was quick.

    I have a large text file containing reports delimited with a BEGIN
keyword and an END keyword. A keyword "HARDWARE" is contained
within some of these reports. Those I need to print to unique files.
One report to a unique file name. I am obviously new at this. But, I
have read and looked and can't find a good example. I can hack
thru the syntax stuff but the logic is killin' me. Any hints would be
greatly appreciated.

						David W. Hill



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

Date: Wed, 08 Oct 1997 21:09:35 -0400
From: Benjamin Holzman <bholzman@mail.earthlink.net>
To: Todd Carlton <todd@pca.net>
Subject: Re: Need To Clear Screen With Perl 5...?
Message-Id: <343C2ECF.2FE24E95@mail.earthlink.net>

[posted & mailed]

Todd Carlton wrote:
> 
> I have two related questions. Both should be EASY for experienced perl
> people...
> 
> (1) I'm converting some old basic programs to perl to run over telnet
> sessions (don't ask...) and need to be able to clear the screen... Any idea
> what the perl clear screen command is?!?!? (DOS=cls linux=clear)

You should probably check out some of the Term:: modules in the standard
distribution and available on CPAN for, I hope, a terminal-independent
method to clear the screen.  Not sure exactly what you should look for,
as I've never done this kind of thing, but if you poke around, I'm sure
you'll find something useful.

> 
> (2) I wrote a script that outputs to a browser. I need it to auto-update
> every two seconds without having to click the reload button. If I use a
> goto label, the output just starts walking down the page over and over. I
> either need to re-call the script every two seconds, or I need to
> auto-forward the browser back to the script every two seconds. I tried
> 'system' and 'exec' WITHOUT SUCCESS.

Not surprising.  If you're using CGI.pm (and why aren't you?), you want
to use the 'Refresh' option in the 'header' method.  If not, you need to
put
<META HTTP-EQUIV="Refresh" CONTENT=120>
inside your <HEAD></HEAD> tags.  You might want to consult a CGI faq.
http://language.perl.com/faq/

> I have very limited access to news, but e-mail flows freely. A reply to
> todd@pca.net would make my day!
> 
> -Todd Carlton


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

Date: Wed, 8 Oct 1997 21:57:08 -0400
From: "David Miller" <dmiller@region.net>
Subject: needed: date stamp of a graphic file being loaded into an HTML
Message-Id: <61hdha$4r3$1@alpha2.vaxxine.com>

 I need, what I feel should be a very simple script. This script would
determine the date stamp of a graphic file being loaded into an HTML
document and then display the date in the HTML document. So that the user
would know that the picture is old, recent, etc.

In advance....
Thank you!

David Miller






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

Date: Wed, 08 Oct 1997 22:11:13 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: needed: date stamp of a graphic file being loaded into an HTML
Message-Id: <comdog-ya02408000R0810972211130001@news.panix.com>

In article <61hdha$4r3$1@alpha2.vaxxine.com>, "David Miller" <dmiller@region.net> wrote:

> I need, what I feel should be a very simple script. This script would
>determine the date stamp of a graphic file being loaded into an HTML
>document and then display the date in the HTML document. So that the user
>would know that the picture is old, recent, etc.

assuming you are using Perl (which you didn't mention in your VERY similar
post in c.i.w.a.cgi), you want to look at the stat function or the file
test operators.  it's all in the man pages (perhaps perlfaq5...).

good luck :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 08 Oct 1997 16:58:03 -0700
From: Chris Schoenfeld <chris@ixlabs.com>
Subject: Perl 5.004_03 and Time::HiRes not compatible?
Message-Id: <343C1E0B.850CCE7A@ixlabs.com>

I haven't been able to install Time::HiRes 1.10 into my new
perl5.004_03. Any help would be appreciated.

on 'make':
HiRes.c:217: invalid format `#line' directive
make: *** [HiRes.o] Error 1

Lines 215-230 of HiRes.c:

    /* Initialisation Section */

#line  "HiRes.xs"
#if XSubPPtmpAAAA
#endif
#if XSubPPtmpAAAB  
#endif
#if XSubPPtmpAAAC
#endif
#if XSubPPtmpAAAD
#endif
#if XSubPPtmpAAAE
#endif
#line 229 "HiRes.c"

    /* End of Initialisation Section */


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

Date: Wed, 08 Oct 1997 23:06:57 GMT
From: user@elektra.u-net.com (P Chappell)
Subject: Please help!
Message-Id: <343c1200.38476437@news.u-net.com>



Please - does anybody have any experience with Microsoft Personal Web
Server? I am trying to get the thing to run a Perl CGI script. Any
Perl script would do. Have Perl, have CGI, have browser, have Web
server, have "HTTP/1.0 500 Server Error", whatever the fuck that
means.

Microsoft, scumbags that they are, provide no documentation for the
server. I've spent more hours than I'd care to admit searching their
web site, MSDN disks, etc.

Please e-mail me if you have any experience with this...

Many thanks,

Paul



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

Date: Wed, 08 Oct 1997 18:07:56 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Problem with script in LLama book
Message-Id: <comdog-ya02408000R0810971807560001@news.panix.com>

In article <343ce615.1532737@news.wwa.com>, faust@wwa.com wrote:

>On Wed, 08 Oct 1997 18:51:22 GMT, amacater@galactic.demon.co.uk
>(Andrew Martin Adrian Cater [Andy]) wrote:
>
>>No obvious reason why: I can't get the script on page 10 to
>>work.

>>It dies on the line with
>>
>>$secretword = $words(name);

>>Script is typed verbatim from the book.

sometimes you need to peer more closely to distinguish the curly
braces from the parenthesis :)

>I don't have a Llama Book in front of me, 

you don't have a copy with you at all times?  ;)  i know of at least
one person that walks around with a complete set of perl man pages -
didn't think to ask if he had a copy of any Perl books with him 
though...


>but I am almost sure that
>Randal would have written
>
>:$secretword = $words{$name};

and so he did...

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

Date: Wed, 8 Oct 1997 20:58:02 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Problem with script in LLama book
Message-Id: <andh16.ki.ln@localhost>

brian d foy (comdog@computerdog.com) wrote:

: >I don't have a Llama Book in front of me, 

: you don't have a copy with you at all times?  ;)  i know of at least
: one person that walks around with a complete set of perl man pages -
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: didn't think to ask if he had a copy of any Perl books with him 
: though...


Does he use a wheelbarrow?

That's what I use...


--
    Tad McClellan                          SGML Consulting
    tadmc@flash.net                        Perl programming
    Fort Worth, Texas


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

Date: 8 Oct 1997 23:35:41 GMT
From: yee@socrates.berkeley.edu (Raymond Yee)
Subject: Q: hash key confusion
Message-Id: <61h5cd$b2$1@agate.berkeley.edu>
Keywords: hash,associative array

Hi everyone,

Please help me to understand the following construct in perl:

$Test{$string1,$string2}

which I found in some code that I'm studying.

I've been trying to understand how the input key gets evaluated but
have not been able to rationalize what I think is the actual behavior --
shown in the following code:

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

#!/usr/local/bin/perl5
 
$string1 = "a";
$string2 = "b";
$Test{$string1,$string2} = "my example";
 
# print out the who
foreach $key (sort keys %Test) {
        print $key,"-->",$Test{$key},"\n";
}
 
# Show that the key is not just $string1.$string2
 
$key1 = $string1.$string2;
print "If I use the key $string1$string2-->",$Test{$key1},"\n";
 
# Show that the key is actually $string1 and $string2 with a Ctrl-\
# stuck between.
 
$key2 = $string1."\x1c".$string2;
 
print "If I use the key $key2-->", $Test{$key2},"\n";

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

The output to this program actually has a Ctrl-\ imbedded in the
key (i.e., a^\b):

a^\b-->my example
If I use the key ab-->
If I use the key a^\b-->my example


[output is run through less to show the control character.]

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

Now that I've figured out what's happening, I don't understand why 
the key a^\b is being generated.  Please help me to understand
how perl parses  $Test{$string1,$string2}.  (It's driving me crazy :-))

Thanks in advance,

-Raymond



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

Date: Thu, 09 Oct 1997 09:35:07 +1100
From: Ron Savage <rpsavage@ozemail.com.au>
Subject: Re: Q:perl beautifier?
Message-Id: <343C0A9B.5AA3@ozemail.com.au>

Will Morse wrote:
> 
> What could be more beautiful than perl?
> 
> In article <343A917A.3DE0@nortel.ca>,
> Anton Fernando  <secdevc2@nortel.ca> wrote:
> >hi folks,
> >       Like cb (C beautifier), is there one for Perl5.* ?
> >[snip]

#!/usr/bin/perl

# 'pb' Perl Beautifier

# Written by P. Lutus Ashland, Oregon lutusp@arachnoid.com 5/20/96

# This script processes Perl scripts, cleans up and indents, like cb does for C

# Be careful with this script - it accepts wildcards and processes every text file
# that meets the wildcard criteria. This could be a catastrophe in the hands of the unwary.

$tabstring = "  "; # You may place any tab-stop characters you want here

if($ARGV[0] eq "") {
  print "usage: file1 file2 etc. or wildcards (replaces originals in place)\n";
}
else {
  foreach $filename (@ARGV) {
    if(-T $filename) {
      &process($filename);
    }
  }
}

sub process {
  $fn = $_[0];
  undef $/; # so we can grab the entire file at once
  undef @infa; # prevent left-overs
  print STDERR "$fn";
  open (INFILE,$fn);
  @infa = split(/\n/,<INFILE>);
  close INFILE;
  
  $/ = "\n"; # restore default
  
  open (OUTFILE,">$fn");
  $tabtotal = 0;
  for (@infa) {
    
    s/^\s*(.*?)\s*$/$1/; # strip leading and trailing spaces
    
    $a = $_; # copy original string
    $q = $a; # i plan to modify this copy for testing
    $q =~ s/\\\#//g; # remove escaped comment tokens
    $q =~ s/\#.*?$//g; # remove Perl-style comments
    $q =~ s{/\*.*?\*/} []gsx; # remove C-style comments
    $q =~ s/\\\{//g; # remove escaped left  braces
    $q =~ s/\\\}//g; # remove escaped right braces
    $q =~ s/\\\(//g; # remove escaped left  parentheses
    $q =~ s/\\\)//g; # remove escaped right parentheses
    
    $q =~ s/\'.*?\'//g; # remove single-quoted lines
    
# now the remaining braces/parentheses should be structural
    
    $delta = -($q =~ s/\}/\}/g); # subtract closing braces
    $delta += ($q =~ s/\{/\{/g); # add opening braces
    
    $delta -= ($q =~ s/\)/\)/g); # subtract closing parens
    $delta += ($q =~ s/\(/\(/g); # add opening parens
    
    $tabtotal += ($delta < 0)?$delta:0; # subtract closing braces/parentheses
    
    $i = ($tabtotal > 0)?$tabtotal:0; # create tab index
    
    $tabtotal += ($delta>0)?$delta:0; # add opening braces/parentheses for next print
    
    if(substr($a,0,1) ne "#") { # don't tab comments
      print OUTFILE $tabstring x $i; # "tab" out to position
    }
    
    print OUTFILE "$a\n"; # print original line
  } # -- for (@infa)
  
  close OUTFILE;
  
  if($tabtotal != 0) {
    print STDERR " Indentation error: $tabtotal\n";
  }
  else {
    print STDERR "\n";
  }
} # sub process


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

Date: Wed, 08 Oct 1997 18:21:59 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Syntax
Message-Id: <comdog-ya02408000R0810971821590001@news.panix.com>

In article <343BF868.7A28@jersey.net>, Josh <josh@jersey.net> wrote:

>How would I test to see if $test is equal to either 0 or 1 or 2 or x or
>X.  Nothing else and not a combination of 2 or more.

if( $test =~ m/^[012xX]$/ )

if( $test eq '0' or $test eq '1' 
                 or $test eq '2' 
                 or $test eq 'x' 
                 or $test eq 'X' );

 ...and so on...

btw, you might want to see the frequently posted message about choosing
good subject lines :)

-- 
brian d foy                                  <comdog@computerdog.com>
NY.pm - New York Perl M((o|u)ngers|aniacs)*  <URL:http://ny.pm.org/>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>


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

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

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