HDTenEightyP/NetNews huggingface dataset:
From: cos@chaos.cs.brandeis.edu (Ofer Inbar)
Subject: Re: easier way to determine set membership?
Organization: Brandeis University
Date: Tue, 21 Jul 1992 20:18:46 GMT

tye@spillman.uucp (E. Tye McQueen) writes:
>Tom Christiansen <tchrist@convex.COM> writes:
>)From the keyboard of tye@spillman.uucp (E. Tye McQueen):
>):    @list =   ('bob', 'fred', 'joe', 'george');
>):    @group{@list} = (1) x @list;
>)
>)Um, yes, that's an exact quote from the posting of mine that
>)you quoted.  What's the difference?
>
>From memory your posting had the last line of:
>
>    @group{@list} = ();
>
>and a note about how this is a bit of a pain because you can't just
>check for "true".  My, admitedly slight, modification allows you
>to simply use $group{$element} as a boolean.

From TomC's original posting:
>Using as associative array is the right way to go for sets.
>A grep can pretty much always replace a for loop (except
>that you can't last out of it.)
>
>    grep ($group{$_}++,  'bob', 'fred', 'joe', 'george');
>    print "$x is ", ($group{$x} ? "" : "not "),  "a member\n";
>
>or
>
>    @list =   ('bob', 'fred', 'joe', 'george');
>    grep ($group{$_}++,  @list);
>    print "$x is ", ($group{$x} ? "" : "not "),  "a member\n";
>
>or
>    @list =   ('bob', 'fred', 'joe', 'george');
>    @group{@list} = (1) x @list;

Look at the last two lines above.  This is what Tom was referring to
when he said you made an exact quote from his posting.  You did :-)

And later on, from TomC's original posting:
>BTW, if you just want to make keys, you could do this:
>
>    @list =   ('bob', 'fred', 'joe', 'george');
>    @group{@list} = ();
>
>But then you can't really check $group{$member}, since its value will be
>undef.  But you can check it using keys() if you want.

Note the "if you just want to make keys."  Your correction to the
above section was actually a bug :-) since it took code meant to "just
make keys" and made it make keys *and* values instead.

Larry Wall then wrote:
>In article <1992Jul16.180214.17784@news.eng.convex.com> tchrist@convex.COM (Tom Christiansen) writes:
>: BTW, if you just want to make keys, you could do this:
>: 
>:     @list =   ('bob', 'fred', 'joe', 'george');
>:     @group{@list} = ();
>: 
>: But then you can't really check $group{$member}, since its value will be
>: undef.  But you can check it using keys() if you want.
>
>Or say
>
>	@group{@list} = (1) x @list;
>
>Larry

  Well, I guess if Larry can make the same mistake, that gives it a
measure of respectability, eh?  Guess you don't have to feel too bad
about it :-).  Aren't these misunderstandings fun!

  --  Cos (Ofer Inbar)  --  cos@chaos.cs.brandeis.edu
  --  WBRS (BRiS)  --  WBRS@binah.cc.brandeis.edu  WBRS@brandeis.bitnet
  "Good literature is about Love and War."
  "Junk fiction is about Sex and Violence."
Newsgroups: comp.lang.perl
From: ball@msdrl.com (Richard Ball)
Subject: too slowwwww....
Organization: Merck Research Laboratories
Date: Fri, 24 Jul 92 19:55:47 GMT

After learning a little perl I thought I would apply it to a task I had in
reformatting a postscript file. My filter, not surprisingly I guess, runs very
slowly and since there are few here with interests in speed and scalability I
would like to solicit suggestions for improvement.
The input file looks like this
 5.939 u  6.001 u mt
 4.002 u  3.221 u lt
[ with lots more lt type lines]
s
 7.845 u 1.669 u mt
[etc., etc.]
for about 9 or 10 K lines. What I want to do is multiply each of the numbers
by a factor, strip out the u characters, strip off the t characters and convert
the s to S, ie.
427.6 432.1 m
288.1 231.9 l
[etc.]
S
[and so on]

The guts of my script are:
while (<STDIN>){
  if (/^s/) {print "S\n"; next;}
  tr/u//d;
  ($x, $y, $mode) = split(' ');
  chop($mode);
  $x = $x * 72;
  $y = $y * 72;
  printf "%6.1f %6.1f $s\n", $x, $y, $mode;
}

But this takes almost a minute on an 8K line file. From some testing its clear
the split and the printf are the worst time hogs. I want the effects of the
printf though so I only get 1 decimal place on the output. 
Anyone got any tricks that will get the time down?

R.G. Ball                    |  phone: 908-594-5341
Merck Research Laboratories  |  FAX:   908-594-6645
PO Box 2000, MD:RY80N-18A    |  email: ball@msdrl.com
Rahway, NJ 07065  USA        |    or   ...!uunet!msdrl!ball
From: wierda@ltb.ltb.bso.nl (Gerben Wierda)
Newsgroups: comp.lang.perl
Subject: Commercial support for perl?
Date: 22 Jul 92 08:28:33 GMT
Organization: BSO/LT, Baarn, The Netherlands


Suppose I would start a company that offers this kind of support to
organisations. Say, I support them with perl and gcc etc. In short., I become
their link to the net if I don't know it immediately.

If these companies would have their own net access there wouldn't be a
problem. But if I sell support and I use the net for that, ain't I misusing
the net? (To be fair, I would be helping people with answers I know too, but
that is beside the point here).

If I sell support for perl etc and use the net for help if I do not know the
answer am I just acting as a combined "interested programmer with net access"
for those companies or am I misusing the net for personal gain?
-- 
wierda@ltb.bso.nl (Gerben Wierda) || I speak for myself and not for my employer.
(+31) 2154 84415/(+31) 35 833539  || Support the League for Programming Freedom!
	"If you don't know where you are going, any road will take you there."
	Lewis Carroll, "Alice in Wonderland".
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: *Another* embarrassingly simple question
Date: 23 Jul 92 19:02:59 GMT
Organization: NetLabs, Inc.

In article <21982@venera.isi.edu> sondeen@isi.edu (Jeff Sondeen) writes:
: By the way, I found some type of problem tring to use vec's.
: 
: 	#! /local/bin/perl
: 	
: 	$num = 5;
: 	for $bits (1..20) {
: 		vec($numv, 0, $bits) = $num;
: 		@num = reverse(split(//,unpack("b$bits", $numv)));
: 		$line = join('',@num);
: 		print "$line\n";
: 	}
: 
: gives:
: 
: 1
: 01
: 101
: 0101
: 00101
: 000101
: 0000101
: 00000101
: 000000101
: 0000000101
: 00000000101
: 000000000101
: 0000000000101
: 00000000000101
: 000000000000101
: 0000010100000000	## what happend here????
: 00000010100000000
: 000000010100000000
: 0000000010100000000
: 00000000010100000000

vec() is only intended to work with $bits of 1, 2, 4, 8, 16, or 32.

Larry
Newsgroups: comp.lang.perl
From: lwvanels@athena.mit.edu (Lucien W. Van Elsen)
Subject: Re: stat.pl query
Reply-To: lwvanels@MIT.EDU
Organization: Massachusetts Institute of Technology
Date: Tue, 28 Jul 1992 18:51:10 GMT

stuart@ds3100.new.dec.com (Stuart Broderick) writes:
>   When this runs, I get 
>
>   st_mode st_uid  st_gid
>   33224   1103    100
>
>   When I do a "ls -lag ./test",  I get
>
>   -rwx--x---  1 stuart   espo       286720 Jul 28 17:56 ./test
>
>   The username and group are correct (st_uid, st_gid), but what does
>   st_mode relate to ? 
>   I expected it to give 0710. 

A couple things should clear this up- First, the st_mode field gives more
than just the file protection; it also contains the type of the file.
Additionally, st_mode is returned in decimal.  33224 is 0100710 in octal;
according to /usr/include/sys/stat.h under Ultrix, _S_IFREG is 0100000.  So,
the file you stat'd is a regular file with the protections you expected.

	-Lucien
From: rm55+@pitt.edu (Rudolph T Maceyko)
Newsgroups: comp.lang.perl
Subject: dosperl-4.035 problems
Summary: broken?
Keywords: dos perl-4.035 broken?
Date: 26 Jul 92 02:59:40 GMT
Organization: University of Pittsburgh


Has anyone had trouble with dosperl-4.035 (the DJGPP one found in
ftp.umanitoba.ca:/pub/msdos/perl/perl386.zoo)?

It seems that one can only use formats that have the same name as the
filehandle.  Any other setting of $~ results in no output.

The following test program fails doubly under this version of perl, but
works on the previous (4.019, not DJGPP, also from ftp.umanitoba.ca):


#!/usr/bin/perl

$a = 'apples';
$b = 'banana';
$c = 'cabins';

format STDOUT_1 =
@<<<<<<< @<<<<<<< @<<<<<<<
$a,      $b,      $c
.

format STDOUT_2 =
@>>>>>>> @>>>>>>> @>>>>>>>
$c,      $b,      $a
.

while (<>)
{	$~ = ($. % 2) == 1 ? STDOUT_1 : STDOUT_2;
	write;
}

__END__


The command:

D:\PERL2> perl test.pl

results in a new prompt.


I don't use the "while (<>)" in any other script under DOS, so I first
ran into its not working while running this test program.

When "while (<>)" is changed to "while (1)", there is no real output,
just the newlines from my hitting return.


Also,

D:\PERL2> perl -de 0

never prompts me for input, but it waits for it.  Again, all I see is the
blank screen created by hitting return after return.  This might be caused
by my still using the perl-4.019 perldb.pl.

I don't have these problems with perl-4.035 on any other platform.

And yes, I have set go32=emu d:\perl2\emu387.


Thanks,
Rudy

-- 
Rudy Maceyko
<rm55+@pitt.edu> or <rtm+@cmu.edu>
Pittsburgh, Pennsylvania USA
From: x920031@rubb.rz.ruhr-uni-bochum.de (Jost Krieger)
Newsgroups: comp.lang.perl
Subject: small clip problems
Date: 24 Jul 92 09:28:01 GMT
Organization: Ruhr-Universitaet Bochum, Rechenzentrum

I got clip running fine with perl 4.0.35 on a MIPS machine (I just had
to comment out the setpriority, because the last compile was in the
SYSV environment.)

Now clip clips all the interesting stuff, and I'm interested in a lot
of things. Say python, the programming language/environment. So I write in my
.cliprc:

&SCANNER(<<'END');
 study;
 &hit if /\b[Pp]ython/;
 &hit if /\b[Pp]erl/;
 &hit if /\balex\b/;
 &hit if /\bWAIS\b/;
END

among other things. Whoops, I got a lot of witty sayings from Monty Python.

So I change to:

 if (/\b[Pp]ython/) {{
	next if $` =~/Monty/;
	&hit;
 }}

as the man page directs me. All clipping stops. Doesn't that trick
work any more in .35 ?

Jost
--
-- 
Jost Krieger, Rechenzentrum der Ruhr-Universitaet Bochum
x920031@rubb.rz.ruhr-uni-bochum.de
g=Jost;s=Krieger;ou=ruba;ou=rz;pd=ruhr-uni-bochum;ad=dbp;c=de
-- 
-- 
Jost Krieger, Rechenzentrum der Ruhr-Universitaet Bochum
x920031@rubb.rz.ruhr-uni-bochum.de
g=Jost;s=Krieger;ou=ruba;ou=rz;pd=ruhr-uni-bochum;ad=dbp;c=de
From: tchrist@convex.COM (Tom Christiansen)
Newsgroups: comp.lang.perl
Subject: Re: kosher?
Date: 29 Jul 92 19:31:25 GMT
Reply-To: tchrist@convex.COM (Tom Christiansen)
Distribution: comp.lang.perl
Organization: CONVEX Realtime Development, Colorado Springs, CO
Originator: tchrist@pixel.convex.com
X-Disclaimer: This message was written by a user at CONVEX Computer
              Corp. The opinions expressed are those of the user and
              not necessarily those of CONVEX.

From the keyboard of robt@is.morgan.com (Rob Torop):
:I recently discovered that rather than using
:
:    $a{'blah'} = 'bleh';
:
:I can get away with
:
:    $a{blah} = 'bleh';
:
:i.e. it seems to have exactly the same effect.  Is there any reason I
:shouldn't do this?

Or even 

     $a{blah} = bleh;

The problem is that Larry might make blah or bleh reserved words.

I'm not very fond of autoquoted strings, personally, but I use
them in throw-away programs.  It's safer if they're not all
lower-case, but still Unclean.

--tom
-- 
    Tom Christiansen      tchrist@convex.com      convex!tchrist
    You know, by the time you get some with all this, the "Swiss Army
    Chainsaw" is going to be more like a Swiss Army Tactical Nuke....  :-)
        --Brandon Allbery on perl in <1991Feb21.002412.20045@NCoast.ORG>
From: doi@jrd.dec.com (Hitoshi Doi)
Newsgroups: comp.lang.perl
Subject: Re: Perl and low-memory environments
Date: 29 Jul 92 00:03:23 GMT
Organization: DEC Japan Research and Development Center

In article <1992Jul28.164057.14549@Princeton.EDU>, rjc@onion.princeton.edu (Raymond Chen) writes:
# Although perl was written for 32-bit virtual memory UNIX boxes,
# many of us use it on 16-bit low-memory machines like IBM PC's.
# (Beyond spec, I know, but hey.)

You can run 32 bit programs if your PC is a 386:-)

# I'm wondering if any of my MS-DOS brethren have any space-saving
# tips to share.  I'm already using the following tricks:
# 
#   - Use the symbol table as an associative array.
#   - Don't load subroutines until they're needed.
#   - Discard subroutines when they're no longer needed.

How's the performance with these tricks?

# But that's still not enough.  I'm thinking of moving all of main
# into subroutines so that I can discard bits and pieces of main as
# they are no longer needed.
# 
# Has anyone had experience tuning code for low-memory machines?

I tried, and failed.  Some of my perl programs are just too big to
even load up on MS-DOS.  I get "out of memory" before it even runs.
So I built perl with DJGPP.

One thing that helped a little (or it could have been my imagination)
is to not use local() variables.
--
Hitoshi Doi, International Open Systems Engineering        doi@jrd.dec.com
Japan Research and Development Center               decwrl!jrd.dec.com!doi
Digital Equipment Corporation Japan          [from Japan: doi@dec-j.co.jp]
From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.lang.perl
Subject: Re: newsclip vs. latest version
Date: 24 Jul 92 18:36:20 GMT
Organization: NetLabs, Inc.

In article <1992Jul23.233119.21823@fernwood.mpk.ca.us> mwm@fernwood.mpk.ca.us (Mike Meyer) writes:
: I'm having trouble convincing newsclip to run. It is calling scanner
: as articles come in, but appears never to leave them. I suspect the
: problem may be that this perl is 4.0.1.4, at patch level 10.
: 
: Could someone confirm that newsclip requires features/bug fixes that
: aren't in that patch level?

Yes, it uses eval {}, which is more recent than 4.010.  It could be
replaced with an eval '', but it wouldn't run as fast.  The eval can
be taken out entirely because it's there to catch the

    die "You should never see this\n";

which is just a short circuit and can be deleted, again at the expense
of some overhead.

By the way, "newsclip" is a program of Brad Templeton's.  I did a
s/newsclip/clip/g to mine and sent it out again--you probably only
saw the first copy.

Larry
Newsgroups: comp.lang.perl,comp.sys.ncr
From: nolan@tssi.com (Michael Nolan)
Subject: Problem compiling Perl 4.035 on NCR Tower
Reply-To: nolan@tssi.com
Organization: Tailored Software Services, Inc.
Date: Sun, 26 Jul 1992 22:27:25 GMT

While compiling perl 4.035 on an NCR Tower/450 SVR2 (2.01.00), I get the
following error:

Assembler: teval.c
	aline 9708	: short switch table span exceeded.

Any suggestions on how to get around this would be appreciated.

In order to get this far, I had to change config.sh as follows:

ccflags=' -W2,-Sl,2000 00 '
---
Michael Nolan, nolan@tssi.com      "Freedom of the press is still alive in    
Tailored Software Services, Inc.    America, at the U. S. Mint"  (Gallagher)   
Lincoln, Nebraska (402) 423-1490  
Newsgroups: comp.lang.perl
From: asherman@laser.fmrco.com (Aaron Sherman)
Subject: Exception handling (was: Re: or puzzlement)
Reply-To: asherman@fmrco.COM
Organization: I-Kinetics, 19 Bishop-Allen Dr., Cambridge, MA
	<Bs2HMz.Gqp@cs.psu.edu>
Date: Wed, 29 Jul 1992 15:29:50 GMT


One thing that I was doing, when I was trying to write a perl
interface to the X protocol, involved an exception handling library 
that would handle the concept of having multiple errors occur in one
call.

What I came up with was something that looked like:

	&lib_error_procname($0);
	
	unless (&openfoo)
	{
		&lib_error_die('opening output file');
	}

	sub openfoo
	{
		# This function will return false if BOTH opens fail.
		unless(open(FOO,"foo"))
		{
			# Log that the open failed, but do not return false.
			&lib_error('OPENFAIL',"foo: $!");
			# If this open fails, then the routine fails.
			open(FOO,'bar') || &lib_error('OPENFAIL',"bar: $!");
		}
	}

If this failed, then you would get:

	testprog: Error opening output file:

		Open call failed: foo: No such file or directory.
		Open call failed: bar: No such file or directory.

This has many personal quirks (like wanting a "list of known errors"
ala perror), but served the purpose of having subroutines that didn't
need to know why they were being called, or print out errors, and
still returned a list of problems.

BTW: one important feature is that &lib_error ALWAYS returns false.


			-AJS

--
--------
Disclaimer: I am solely responsible for the content of this message.
The views expressed here may not be the views of I-Kinetics, Fidelity,
any of the Fidelity-owned corporations or my mother.
From: sondeen@isi.edu (Jeff Sondeen)
Newsgroups: comp.lang.perl
Subject: Re: "b subname" doesn't work in "perl -d" (v. 4.019) ?
Date: 28 Jul 92 02:45:07 GMT
Reply-To: sondeen@isi.edu (Jeff Sondeen)
Organization: USC-Information Sciences Institute
Keywords: nn

In article <1992Jul23.191956.9796@netlabs.com> lwall@netlabs.com (Larry Wall) writes:
>Your subject line answers your question.  Upgrade to 4.035.
>
						^^^^^^^^^^^
					getting there, so far at 4.034

I'm happy to report that the "break subname"'s are working in 4.034,
but now I'm getting "Malformed cmd links" from perl, although
"Configure" and "make" seemed to have gone fine.  It was the same for
4.033.  Is this indicative of an obvious mistake?

   perl edifi.p bigmult.edn 
Malformed cmd links
   toplibrary: BIGMULT
   topview: view_1
   ...

This is perl, version 4.0

$RCSfile: perl.c,v $$Revision: 4.0.1.7 $$Date: 92/06/08 14:50:39 $
Patch level: 34

Copyright (c) 1989, 1990, 1991, Larry Wall
			      ^^^^
				hey don't forget 1992 (it's almost 1993)!


By the way, where can I find the patch 35 -- I missed it and it isn't
on ftp.uu.net and certainly not on jpl-devvax.jpl.nasa.gov (details
follow)

ftp ftp.uu.net
	ftp> cd usenet/comp.sources.misc/volume30/perl   
	ftp> ls
		patch20.Z
		patch23.Z
		patch21.Z
		patch22.Z
		patch24.Z
		patch25.Z
		patch26.Z
		patch27.Z
		patch29.Z
		patch30.Z
		patch28.Z
		patch31.Z
		patch32.Z
		patch33.Z
		patch34.Z
(that's it)

ftp jpl-devvax.jpl.nasa.gov
	ftp> cd perl.4.0
	ftp> ls
		.package
		README
		gdbm.pat
		kits@10
		kits@19
		kits@33
		patches
		patchlevel.h
		scripts
		ftp> cd patches
		ftp> ls
			patch01
			patch02
			patch03
			patch04
			patch05
			patch06
			patch07
			patch08
			patch09
			patch10
			patch11
			patch12
			patch13
			patch14
			patch15
			patch16
			patch17
			patch18
			patch19
(that's it)
--
/jeff

Life and love are as deep [as your] eyes are wide... -Rush
Newsgroups: comp.lang.perl
From: kahn@PHYSICS.UNC.EDU (Dan Kahn)
Subject: Account "Management" Perl Script Need
Organization: Physics Dept. UNC-CH
Date: Wed, 22 Jul 1992 13:58:34 GMT

I'd like to find a perl script that would let me do simple things
like create accounts and delete them.  I've looked in a few places
but I haven't seen anything.  Can anyone help?

Thanks,
--dan
From: serganov@asmara.berkeley.edu (Serganova Vera)
Newsgroups: comp.lang.perl
Subject: Bug or feature in a subroutine inside s///e
Summary: a subroutine inside s///e causes a change to the argument
Date: 26 Jul 92 08:40:10 GMT
Organization: U.C. Berkeley Math. Department.
NNTP-Posting-Host: asmara.berkeley.edu

The following code:
------------------------cut here---------------------

sub generate_label {
	local($_)=$_[  $[ ];		
	# this causes bad behaviour inside ///ge - subroutine changes the argument
	s/\s+/_/g;
	# commenting the next line cures the problem:
	s/(^.{0,20}).*/\1/;
	$_;
}

$_="a a";
s/(.+)/&generate_label(\1).\1/ge;
print;

------------------------cut here---------------------

gives the output is "a_aa_a"  instead of "a_aa a" on perl 4.10 on SunOS 4.1.1.

I have no reach to 4.035, so any comment on being outdate are welcome.

Is it a bug or a feature? I could avoid it in my script, but this was
very nasty.

Wouldn't anyone comment on this being known?

Best regards, Ilya
From: beaker@milton.u.washington.edu (Clint Olsen)
Newsgroups: comp.lang.perl
Subject: Thanks for the help on Perl w/SunOS4.1.2 & gcc2.2.2
Date: 28 Jul 92 01:02:40 GMT
Organization: University of Washington, Seattle


Hello:

I removed the -I/usr/ucbinclude for cppflags AND ccflags and
the only test error I got was:

sh:  cppstdin:  file not found.

or something like that.  Someone told me that this test would
bomb out, but I just wanted to verify that I did indeed remove
the correct flags.

make ended with an error:

make:  *** [test] Error 2 (ignored)

Thanks.

Clint Olsen
olsenc@maxwell.ee.washington.edu
Newsgroups: comp.lang.perl
From: rantapaa@s6.math.umn.edu (Erik E. Rantapaa)
Subject: Re: Seemingly Small Feature
Organization: University of Minnesota
Distribution: na
Date: Fri, 31 Jul 1992 06:38:39 GMT

jbence@julia.math.ucla.edu (James K. Bence) writes:

>I would like to be able to reset the iterator that each,keys,values use
>when I want, rather than being forced to go thru the whole array.  Is
>this an unreasonable feature?

How about something like this:

  loop: {
      for $x (@array) {
	  ...
          redo loop if some condition;
          ...
      }
  }
--
        Erik Rantapaa                   rantapaa@math.umn.edu


 Life is a whim of several billion cells to be you for a while.
Newsgroups: comp.lang.perl
From: rantapaa@s6.math.umn.edu (Erik E. Rantapaa)
Subject: Re: iterative matching
Organization: University of Minnesota
Date: Wed, 29 Jul 1992 05:42:53 GMT

barnett@paintbrush.aca.mcc.com (Jim Barnett) writes:

>I would like to do an iterative regexp match and find at each step the
>substring to the right of the match.  That is, given pattern /aa/ and
>string "aabbaacc", I would like to find first "bbaacc" and next "cc".
>But I'm having problems when I try to combine //g with $'.

I too would like to see $' and $` working with //g.  Here's a case
where it would come in handy.  It also shows you one way to get around
the problem -- namely use s///eg:

# pull_quotes -- Erik Rantapaa, rantapaa@math.umn.edu
#
# Based on the original version by Tom Christiansen.
# Only pulls the top level of quotes.

sub pull_quotes {
    local($_, $qchars) = @_;

    local($qL, $qR);		# left and right quote characters
    local($level);		# current quote level
    local(@startstop);		# list of start and stopping locations

    die "need two just quote chars" if length($qchars) != 2;

    $qL = substr($qchars, 0, 1);
    $qR = substr($qchars, 1, 1);

###
### Note: while (/[$qchars]/g) { &startstop; } doesn't work here
### because $` is not set properly.
###
    s/[$qchars]/&startstop/eg;
    while (@startstop) {
	($start, $stop) = splice(@startstop, $[, 2);
	push(@quotes, substr($_, $start+1, $stop-$start-1));
    }
    @quotes;
}

sub startstop {
    if ($& eq $qL) {
	push(@startstop, length($`)) if $level == 0;
	$level++;
    } else {
	if ($level > 0) {
	    $level--;
	    push(@startstop, length($`)) if $level == 0;
	} else {
	    die "Wha happened????";
	}
    }
    $&;
}

Another option is to use:

while (/\w/) {
  ... do stuff here ...
  $_ = substr($_, $[+length($`)+length($&));
}

This eats up $_, but that's probably not a big deal.  Also, it differs
from using s///eg in that $` is the stuff *between* matches, whereas
$` in a s///eg statement is the prefix of the match starting from the
beginning of the string.
--
        Erik Rantapaa                   rantapaa@math.umn.edu


 God is not dead!  He's alive and autographing bibles at Cody's
From: fitch@ittc.wec.com (Ken Fitch)
Newsgroups: comp.lang.perl
Subject: Manipulating Framemaker files with perl?
Date: 27 Jul 92 15:32:34 GMT
Organization: Westinghouse Electric Corp., ITTC, Pgh. PA.

Does anyone know how (and if it is possible) to use perl to 
perform global replacements on files which are in Framemaker
format?

We have a large number of software documentation files in
Frame, and for each project we have to go into each file
and change the project-specific information.  I'd like to
be able to say something like

perl -pi -e 's/PROJECT1/PROJECT2/g' list_of_files...

When I try this, Frame refuses to read the resulting file
(it has been corrupted somehow).  Any clues anyone?

Ken Fitch
fitch@ittc.wec.com
--
Kenneth R. Fitch
fitch@ittc.wec.com
uunet!ittc!fpb
(412)733-6435