[9135] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2754 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu May 28 18:07:33 1998

Date: Thu, 28 May 98 15:01:35 -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           Thu, 28 May 1998     Volume: 8 Number: 2754

Today's topics:
    Re: PC Screen Image File <dk@parka.winternet.com>
    Re: Perl for WindowsNT? <dk@parka.winternet.com>
    Re: Perl for WindowsNT? <dk@parka.winternet.com>
    Re: Perl for WindowsNT? <lr@hpl.hp.com>
    Re: perl modules (John Porter)
    Re: Reading whole file into a scalar (Tad McClellan)
    Re: Reading whole file into a scalar <jdf@pobox.com>
    Re: Statistics for comp.lang.perl.misc (Greg Bacon)
        Two output messages from script <vanes@raptor.com>
    Re: Unix "file" function in perl? (I R A Aggie)
        unpack troubles <rs83@is7.nyu.edu>
    Re: Visibility of "my" vars (Bob Kline)
    Re: Visibility of "my" vars <tchrist@mox.perl.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: 28 May 1998 21:13:42 GMT
From: Dave Kenny <dk@parka.winternet.com>
Subject: Re: PC Screen Image File
Message-Id: <6kkk26$t7v$1@blackice.winternet.com>

Just because perl supports clever and elegant techniques doesn't mean
you have to (or should) be clever and elegant all the time.

I would do something simplistic like:

	@goodPart = array of char/attributes from area of interest;
	@chars = ();
	$nBytes = 0 + @goodPart;
	for ($j = 0;   $j < $nBytes;   $j = 2) {
		push @chars, $goodPart[$j];
	}

That is, extract the characters you want by brute force instead of trying
to be clever.  (While the attribute bytes _might_ all be nonalphanumeric
I would not rely on that!)

I would probably use read() rather than <>, to avoid worries about \r,
\n, binary vs text files etc.  Since you want a bunch of bytes instead 
of a bunch of lines, this seems more intuitive to me.

After reading the file into a string, I'd use substr() to extract the
part(s) where your data is.  For each such chunk I'd say something like

	@goodPart = split //, $chunkOfFile;
	<the bruteforce loop to extract every other byte>
	print join("", @chars), "\n"

(or \r\n if you are running under unix but producing a file for MsDos).

My point is that lots of times I find it easier to use simple minded
code, and run a test after each step toward the final program, so
I can verify that my code is really doing what I think it should.
I find this works much better for me than trying to be clever and
ending up with a program that produces no output!  Those are hard
to debug!

So first I'd just write the code to extract the "lines" of interest
and print them to STDOUT, piping my perl script into od -c or something
where I can see the attribute bytes.

Then I'd probably write a dummy routine to run the for loop on a
string like "0123456789" to be sure I got the even numbers.  Finally
I'd put the for loop inside the reading-the-data loop.

I'll gladly swallow my pride if it gets me working code faster.

info@insyte.com wrote:
: I am attempting to process a file which is actually a PC screen image, i.e.
: each display character is two bytes with the odd numbered byte being an
: attribute. The raw data for the area of interest begins at byte 12 and each
: "line" is 48 displayed charaters (96 data bytes) long. Because its going to a
: fixed format PC display the source data does not contain NLs, the physical
: display simply wraps every 48 characters. My objective is to end up with a
: text file consisting of "lines" of 48 byte data elements.

: The portion of the file that I want has alphamerics and some limited
: punctuation so I have tried reading this file into an array and doing:

:     @out_data = (<FILE>);
:     $out_data =~ tr /a-zA-Z0-9':+/ /c;

: This does get rid of the non-alphamerics (attributes) but leaves me with
: spaces. If I do

:     $out_data =~ tr /a-zA-Z0-9'://c;

: the output ends up with a "ODOA" (new line) after EVERY data character.

: I've tried treating it both as a array and as a scalar with varying results,
: but all negative. Some of the attribute data in the source is things like
: "OA" "OB" OD, etc. Some of the things I've tried have resulted in these
: attributes being treated as if they were NL's etc!

: Any suggestions on how I can process this down to plain ASCII text

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


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

Date: 28 May 1998 19:58:39 GMT
From: Dave Kenny <dk@parka.winternet.com>
Subject: Re: Perl for WindowsNT?
Message-Id: <6kkflf$sks$1@blackice.winternet.com>

Brian J. Sayatovic <bjs@iti-oh.com> wrote:
: Basically.  Perl for NT is about 99% compatible with Perl for UNIX.  Some of
: the crazy IPC, etc. stuff doesn't work but there are workarounds for even
: that.  Furthermore, you have to wrroy about stuff like \'s on NT and /'s on
: UNIX in pathnames.  Witha  bit of concentration, you make a script that will
          ^^^^^^^^^

I've been using WinDoze (not happily) for quite a while and almost always
use normal pathnames instead of the idiotic windows-native names that
use the (backslash) escape character as a delimiter in pathnames.
(Maybe they did this for enhanced geekiness -- windows pathnames in c
have some resemblance to regular expressions in emacs lisp :-)

Using ntperl, ntemacs, the MKS toolkit, the gnu-win32 stuff from Cygnus
etc, I've been able to use very similar environments in Win95 and
Unix (Linux).

I'm not sure what you mean by "crazy IPC, etc. stuff".  I have trouble
with things like `date` but I assumed that was because perl was using
the Micro$oft [non]shell instead of ksh or bash.

I've been using sockets, which seem to work.

The NT/Win95 Perl port also has some spiffy stuff like OLE and ODBC
support that make win32 --- not exactly more palatable --- but less of
an obstacle.  

Q: does select() work under win32?  I've finally hit a situation where
I really want to do nonblocking i/o (or its equivalent.)
 


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

Date: 28 May 1998 20:06:43 GMT
From: Dave Kenny <dk@parka.winternet.com>
Subject: Re: Perl for WindowsNT?
Message-Id: <6kkg4j$sks$2@blackice.winternet.com>

T.J. Arnesen <T.J.Arnesen@collector.org> wrote:
<snip>
: Probably because Perl earlier was written for Unix. The phone bill has
: become very high as I have to pay for every second I am using. It would be
: much cheaper to install Windows server software on my computer. It doesn't
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
?

Server software is irrelevant unless you are trying to write CGI scripts
or something.  You can run Perl on a plain-vanilla Win95 system with
no extras.


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

Date: Thu, 28 May 1998 13:59:32 -0700
From: "Larry Rosler" <lr@hpl.hp.com>
Subject: Re: Perl for WindowsNT?
Message-Id: <6kkj7f$acl@hplntx.hpl.hp.com>

Dave Kenny wrote in message <6kkflf$sks$1@blackice.winternet.com>...
>Brian J. Sayatovic <bjs@iti-oh.com> wrote:
>: Basically.  Perl for NT is about 99% compatible with Perl for UNIX.
Some of
>: the crazy IPC, etc. stuff doesn't work but there are workarounds for
even
>: that.  Furthermore, you have to wrroy about stuff like \'s on NT and
/'s on
>: UNIX in pathnames.  Witha  bit of concentration, you make a script
that will
>          ^^^^^^^^^
>
>I've been using WinDoze (not happily) for quite a while and almost
always
>use normal pathnames instead of the idiotic windows-native names that
>use the (backslash) escape character as a delimiter in pathnames.
>(Maybe they did this for enhanced geekiness -- windows pathnames in c
>have some resemblance to regular expressions in emacs lisp :-)


They (CP/M, I believe) did it because Unix used forward slashes, and
they weren't Unix (and perhaps thought this was a way to avoid
litigation).

>Using ntperl, ntemacs, the MKS toolkit, the gnu-win32 stuff from Cygnus
>etc, I've been able to use very similar environments in Win95 and
>Unix (Linux).


Finally someone has mentioned MKS.  It is very good, and has good
support, and I recommend it highly around here, but it costs MONEY!

>I'm not sure what you mean by "crazy IPC, etc. stuff".  I have trouble
>with things like `date` but I assumed that was because perl was using
>the Micro$oft [non]shell instead of ksh or bash.


The problem with `date` is convincing the command interpreter that the
percent format specifiers don't represent substitutable parameters.
Percent ne dollar-sign (see above for possible rationale).  Try
multipling them up a few times.  Quoting doesn't help much.

>I've been using sockets, which seem to work.


Networking is well supported in Perl and M$ Visual C++ -- a matter of
economic survival, I guess.

 ...

--
Larry Rosler
Hewlett-Packard Laboratories
lr@hpl.hp.com





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

Date: Thu, 28 May 1998 20:29:36 GMT
From: jdporter@min.net (John Porter)
Subject: Re: perl modules
Message-Id: <MPG.fd79502fa38e6a59896fb@news.min.net>

On Thu, 28 May 1998 08:40:00 +0000,
in article <19980528123116.AAA3734@rick.internetx.net>,
rick@internetx.net (Rick Bauman) wrote:
> Is there a comprehensive list of modules needed to use the networking 
> features of perl? I am constantly having to install new modules as I 
> practice some of the things I learn in this newsgroup.

Sounds like maybe you want the libnet and libwww bundles.
They contain most everything you're likely to need for
networking.

John Porter


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

Date: Thu, 28 May 1998 15:31:06 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: Reading whole file into a scalar
Message-Id: <aihkk6.7fd.ln@localhost>

Mike Dolan (mdolan@best.com) wrote:
: I want to read the entire contents of a text file into a single scalar so
: that I can apply regular expressions to that scalar.  Do you know how to do
: this?


1) (recommended)

   undef $/;           # look me up in 'perlvar'...
   $whole_file = <>;



2) (slow on large files)

   $whole_file = join '', <>;



3) (be explicit and slow)

   $whole_file = '';
   while (<>) {
      $whole_file .= $_;
   }



--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 28 May 1998 17:26:23 -0500
From: Jonathan Feinberg <jdf@pobox.com>
To: tadmc@flash.net (Tad McClellan)
Subject: Re: Reading whole file into a scalar
Message-Id: <k976f2wg.fsf@mailhost.panix.com>

tadmc@flash.net (Tad McClellan) writes:

> 1) (recommended)
> 
>    undef $/;           # look me up in 'perlvar'...
>    $whole_file = <>;

You've now trampled $/, which may be unkind to code elsewhere in your
script.

   {
     local $/ = undef;   # mjd likes it explicit.  I used to "local $/;"
     $whole_file = <>;
   }

-- 
Jonathan Feinberg   jdf@pobox.com   Sunny Brooklyn, NY
http://pobox.com/~jdf/


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

Date: 28 May 1998 21:44:14 GMT
From: gbacon@cs.uah.edu (Greg Bacon)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <6kklre$e3q$5@info.uah.edu>

In article <pudge-2805981533440001@dynamic265.ply.adelphia.net>,
	pudge@pobox.com (Chris Nandor) writes:
: Advocacy issues do not belong on clp.moderated.  Any arguments about free
: vs. free belongs on clp.misc if anywhere, not clp.moderated.

I've reread Tom's article, and I don't believe that it was primarily an
advocacy post (although when anyone dares to speak out against the FSF,
it usually results in an ugly flame war).

This is a quote from the recently posted RFD:

    The moderators will decide which posts are of general interest to
    the worldwide Perl community.

I believe the issue Tom brought to the table was of interest to the Perl
community.  Further, I think had it been posted to a moderated group,
the flamefest might have been easier to control.

Greg
-- 
open(G,"|gzip -dc");$_=<<EOF;s/[0-9a-f]+/print G pack("h*",$&)/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


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

Date: Thu, 28 May 1998 21:48:07 +0000
From: Tasha van Es <vanes@raptor.com>
Subject: Two output messages from script
Message-Id: <356DDB96.D08FE020@raptor.com>

Hi -

I've got a script for which I haven't figured out the following perl
complaint. The script runs perfectly, incidently. The message I am
getting is:

Use of uninitialized value at srun line 210, <REQLIC> chunk 52.

Here's the initialization I use:

open(REQLIC, ">$file.$pid");

and I close it up later. What does perl see that I don't? V. 5.002 or
5.004_01 act the same.

Thanks,
Tasha



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

Date: Thu, 28 May 1998 16:46:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Unix "file" function in perl?
Message-Id: <fl_aggie-2805981646120001@aggie.coaps.fsu.edu>

In article <356DB9C0.B1FBFE5@cray.com>, Andrew Hamilton
<hamiltaj@cray.com> wrote:

+ Any suggestions?

Yeah, think about ingesting and using your /etc/magic file, which is
what 'file' uses as a reference guide. _How_ one should use it, I leave
to more experienced minds.

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Fri, 29 May 1998 17:23:27 -0400
From: Ruben I Safir <rs83@is7.nyu.edu>
To: mbitton@easydental.com, ruben@wynn.com, rs83@is7.nyu.edu
Subject: unpack troubles
Message-Id: <356F274F.A4CD7A06@is7.nyu.edu>

I have a database written originally in quick basic for a DOS
aplication.


If has a datatype file that looks as follows:
'Counter:  CONTROL, Start=30, Length=6
TYPE Patient
     FamNum              AS STRING * 5  'Padded VAL
     First               AS STRING * 13 'First Name
     Last                AS STRING * 16 'Last Name
     MTDDebits           AS LONG        '
     MTDCredits          AS LONG        '
     CurrBal             AS LONG        '
     YTDFamilyPmts       AS LONG        '
     YTDPmtsThisPat      AS LONG        '
     PatientFlags        AS STRING * 2  '
     LastTransDate       AS STRING * 6  'String Date
     LastPmtDate         AS STRING * 6  'String Date
     LastTreatDate       AS STRING * 6  'String Date
     LastProphyDate      AS STRING * 6  'String Date
     ProphyRecNum        AS STRING * 1  'BLANK; 1...F (HEX)
     NextProphyDate      AS STRING * 6  'String Date
     NextProphyTime      AS STRING * 4  'String Time
     DentalRecNum        AS STRING * 1  'BLANK; 1...F (HEX)
     NextDentalDate      AS STRING * 6  'String Date
     NextDentalTime      AS STRING * 4  'String Time
     Sex                 AS STRING * 1  'M; F
     MaritalStat         AS STRING * 1  'M; S; W; D  BirthDate
AS STRING * 6  'String Date
     SocialSec           AS STRING * 9  '
     HomePh              AS STRING * 14 '
     WorkPh              AS STRING * 14 '
     Address             AS STRING * 27 '
     City                AS STRING * 17 '
     State               AS STRING * 2  '
     Zip                 AS STRING * 10 '
     NumReferrals        AS STRING * 2  'VAL
     MedDentHistQue      AS STRING * 5  'BOOLEAN
     CumInsBal1          AS LONG        '
     CumInsBal2          AS LONG        '
     LstFamPmtAmt        AS LONG        '
     FamPointer          AS LONG        '
     TransPointer        AS LONG        '
     OldUnposted         AS LONG        '
     FamTransPtr         AS LONG        '
     OldMonthlyPayment   AS LONG        '
     IncomeFromRefer     AS LONG        '
     YTDInsFiled         AS LONG        '
     YTDInsPmtsPrim      AS LONG        '
     YTDInsPmtsSec       AS LONG        '
     PrintFlags          AS STRING * 2  'BINARY [1]=Needs Rolo/Label
printed

 Future1             AS STRING * 1  '
     YTDPrevCrgs         AS LONG        '
     YTDBasicAndMajor    AS LONG        '
     SuppressPosting     AS STRING * 1  'Y; N;
     YTDFinanceChrgs     AS LONG        '
     Future2             AS STRING * 8  'Part of this used to be TITLE.
     LastTransBatch      AS STRING * 1  'ASC
     ApptPtr             AS INTEGER     '
     PreferHyg           AS INTEGER
     PatStatus           AS STRING * 1  'P; R; B;
     PrefDent            AS INTEGER
     PatProvInsPrim      AS STRING * 5  'Padded VAL
     EmpProvInsPrim      AS STRING * 4  'Padded VAL
 EmpProvInsSec       AS STRING * 4  'Padded VAL
     RelToInsPrim        AS STRING * 1  '1=self; 2=child; 3=spouse;
4=other
     Future10            AS STRING * 18 '
     ReferType           AS STRING * 1  'D; P
     ReferredBy          AS STRING * 5  'Padded VAL
     OldChart            AS STRING * 5  'Padded VAL
     SendStatements      AS STRING * 1  'Y; N
     CollAgency          AS STRING * 1  'Y; N; E=Electronic
     AnnivDate           AS STRING * 6  'String Date
     NumInsCovers        AS STRING * 1  '0; 1; 2
     Future4             AS STRING * 7  '
     RecallFreq          AS STRING * 1  'HEX
     CleaningTime        AS STRING * 2  'VAL
     RelToInsSec         AS STRING * 1  '1=self; 2=child; 3=spouse;
4=other
     ChargeInterest      AS STRING * 1  'Y; N
     PatProvInsSec       AS STRING * 5  'Padded Val
     Chart               AS STRING * 6  'Chart number
     OnPaymentPlan       AS STRING * 1  'Y; N; C=Contract
     Conversion          AS STRING * 3
     Location            AS INTEGER     ' ptr to location
     Future11            AS STRING * 1  '
     UnUsed              AS SINGLE      '
     BadDebt             AS STRING * 1  'BLANK; B

END TYPE

'INDEXFILE="PATIENT2"



When I examine a hexdump of the fdata, this matches the record exactly
bite by bite.

Now - using a Perl Script, I want to parse this data using unpack.

My unpack script looks like this:


 open( WORKING_FILE, "/d/dental/"."$allfiles[$i]") or die "Can't open
$allfiles[$i]";
            $j=0;
            print ("OK - It seems not to be a a dot file or directory\n
Lets start parsing it First run in j= $j \n");
        while($parse_file = <WORKING_FILE>){

@datastring =
unpack(a5a13a16llllla2a6a6a6a6aa6a4aa6a4aaa39a6a9a14a14a27a17a2a10a2a5lllllllllllla2allala8cssasa5a4a4aa18aa5a5aaa6aa7aa2aaa5a6aa3saa4a,

$parse_file);

            for($k=0;$k<@datastring;$k++){
                print "$k :: $datastring[$k]//\n";
                }
            $j++;
            }
         print "WHILE is Finished\n";

  The program puts output to the screen such that I can see the feild
sizes.

Some sample data looks like this in a hexdump:


0000000   0   0   0   0   1   J   o   e
0000020           S   a   m   p   l   e
0000040          \0  \0  \0  \0  \0  \0  \0  \0   L 021 002  \0  \0  \0
0000060  \0  \0  \0  \0  \0  \0 001  \0   1   0   0   7   9   6   0   1
0000100   1   4   9   4   1   0   0   7   9   6   0   1   2   7   9   4
0000120
0000140                           M   M
0000160
0000200                                                               1
0000220   2   0   2   0   2   5   5   5   1   1   5   5   5   5   2   1
0000240   2   5   5   5   1   2   1   2
0000260                                           1   2   3       F   i
0000300   r   s   t       A   v   e   .
0000320                       M   o   t   o   r
0000340                           Z   X   1   1   1   1   1   -   1   1
0000360   1   1          \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000400  \0 260 004  \0  \0 001  \0  \0  \0 271 324 377 377
0000420     271 324 377 377                  \0  \0  \0  \0  \0  \0  \0
0000440  \0  \0  \0  \0  \0  \0  \0  \0  \0   !          \0  \0  \0  \0
0000460  \0  \0  \0  \0   N  \0  \0  \0  \0
0000500     232  \0  \0 265 002   B 265 002       1                   7
0000520                           1
0000540                                                               1
0000560                   N   N   1   1   0   6   9   1   1
0000600                   6   4   5       Y                       1   2
0000620   3   4   5   6   N             001  \0                       N
0000640   0   0   0   0   2   M   a   r   t   i   n
0000660           C   h   a   r   l   e   s
0000700          \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000720  \0  \0  \0  \0  \0  \0 001  \0   0   6   1   5   9   5   1   1
0000740   0   9   9   2   0   9   1   9   9   4
0000760
0001000                           F   M
0001020
0001040                                                               0
0001060   5   3   0   4   4   0   4   1   3   8   1   8   6   8   2   1
0001100   2   2   6   0   7   0   4   5
0001120                                           2   8   7       A   v
0001140   e   n   u   e       C
0001160                       N   e   w       Y   o   r   k

0001200                           N   Y   1   0   0   0   9
0001220                  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0001240  \0  \0  \0  \0  \0 002  \0  \0  \0 324 206  \t  \0
0001260     324 206  \t  \0                  \0  \0  \0  \0  \0  \0  \0
0001300  \0  \0  \0  \0  \0  \0  \0  \0  \0   !          \0  \0  \0  \0
0001320  \0  \0  \0  \0   N  \0  \0  \0  \0
0001340      \t  \0  \0 233  \0   B 265 002
0001360
0001400                                                               3


FSting fields that should be 5 bits long are suddenly displaying at the
end as single char fields?  I don't unknow why.  It also seems that the
unpack command is not reacting to \0 quite as it should.

Anyone know how I might changing the TEMPLATE to better handle this?  Or
is there a better way of doing things in PERL?

Does anyone know if using the extended ascii chars might be causing a
problem with a templates?

At one point while running this program in an xterm on Linux with more -
the screen flashed a strange  help or manual page.

Ruben





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

Date: 28 May 1998 19:38:57 GMT
From: bkline@cortex.nlm.nih.gov (Bob Kline)
Subject: Re: Visibility of "my" vars
Message-Id: <6kkegh$mif$1@lhc.nlm.nih.gov>

Jon Drukman (jsd@gamespot.com) wrote:
: In article <6kjju6$rps$1@lhc.nlm.nih.gov>, bkline@cortex.nlm.nih.gov (Bob
: Kline) wrote:

: > my $foo = 8;
: > &bar;
: > sub bar
: > {
: >     $foo += 3;
: >     print "$foo\n";
: > }

: this works as you'd expect.  but don't do it, because this one doesn't:

:  #!/usr/local/bin/perl -w
:  foo();
:  foo();

:  sub foo {
:      my $a = 0;
:      sub bar {
:         $a++;
:      }
:      print bar(),"\n";
:      print bar(),"\n";
:      $a = 10;
:      print bar(),"\n";
:      print bar(),"\n";
:  }

Ouch!  Just when I thought I was beginning to understand.  :->}

Bob


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

Date: 28 May 1998 20:41:57 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Visibility of "my" vars
Message-Id: <6kki6l$o90$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, jsd@gamespot.com (Jon Drukman) writes:
:this works as you'd expect.  but don't do it, because this one doesn't:
:
: #!/usr/local/bin/perl -w
: foo();
: foo();
:
: sub foo {
:     my $a = 0;
:     sub bar {
:        $a++;
:     }
:     print bar(),"\n";
:     print bar(),"\n";
:     $a = 10;
:     print bar(),"\n";
:     print bar(),"\n";
: }

You're doing it wrong. :-)


    foo();
    foo();

    sub foo {
	my $a = 0;
	# sub bar { $a++ } 
	{
	    local $^W;
	    *bar = sub { $a++ };
	}
	print bar(),"\n";
	print bar(),"\n";
	$a = 10;
	print bar(),"\n";
	print bar(),"\n";
    }

--tom
-- 
Besides, it's good to force C programmers to use the toolbox occasionally.  :-)
        --Larry Wall in <1991May31.181659.28817@jpl-devvax.jpl.nasa.gov>


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

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

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