[19544] in Perl-Users-Digest
Perl-Users Digest, Issue: 1739 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Sep 13 03:05:49 2001
Date: Thu, 13 Sep 2001 00:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <1000364706-v10-i1739@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 13 Sep 2001 Volume: 10 Number: 1739
Today's topics:
Re: Convert hex dump to binary (Martien Verbruggen)
Re: create acct locally on PCs for whole domain <Thomas@Baetzler.de>
O Reilly online books <hackertito@yahoo.com>
Re: O Reilly online books (Randal L. Schwartz)
Re: ODBC with perl problem <mfrick@chariot.net.au>
Re: Perl is TOO much fun <uri@sysarch.com>
Re: Perl is TOO much fun (Malcolm Dew-Jones)
Re: Perl is TOO much fun <wyzelli@yahoo.com>
Perl Mongers Check-in <comdog@panix.com>
Re: Printing in Perl <me@REMOVETHIStoao.net>
Re: Printing in Perl (Logan Shaw)
Re: Printing in Perl (Damian James)
Re: Printing in Perl <me@REMOVETHIStoao.net>
Re: Printing in Perl (Logan Shaw)
Re: regex Q: how to exclude strings in a search? <dtweed@acm.org>
Re: regex Q: how to exclude strings in a search? <unspecified@location.com>
Re: Search and Replace and Reformat <davidhilseenews@yahoo.com>
tricky (?) find an replace question <unspecified@location.com>
Re: Using seek and print to insert data into a file. (Tad McClellan)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 12 Sep 2001 23:30:55 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Convert hex dump to binary
Message-Id: <slrn9pvs1f.n8d.mgjv@verbruggen.comdyn.com.au>
On 11 Sep 2001 23:43:15 -0700,
Phil Hibbs <phil.hibbs@capgemini.co.uk> wrote:
> Tad McClellan:
>> #!/usr/bin/perl -w
>> use strict;
>> while(<DATA>) {
>> foreach my $hex ( split /\s+/, substr($_, 6, 23) ) {
>> print chr hex $hex;
>> }
>> }
>
> Wow, thanks! I had to move the "my $hex" up to before the while (may
> be a Perl 5.001 quirk - I know, I should upgrade, don't bother telling
> me),
Yes it is, and yes, you should upgrade. If you want for my $var LIST
to work, you should upgrade to at least 5.005. I'd install 5.6.1.
$ man perlhist
[snip]
Larry 5.001 1995-Mar-13
[snip]
It's over 6 years old, and was really made obsolete in June 1996.
5.001 has some serious security issues. And, most code written
nowadays probably won't work on it anymore, because of the increased
use of the construct at hand.
Martien
--
Martien Verbruggen |
Interactive Media Division | I used to have a Heisenbergmobile.
Commercial Dynamics Pty. Ltd. | Every time I looked at the
NSW, Australia | speedometer, I got lost.
------------------------------
Date: Thu, 13 Sep 2001 08:59:07 +0200
From: =?ISO-8859-1?Q?Thomas_B=E4tzler?= <Thomas@Baetzler.de>
Subject: Re: create acct locally on PCs for whole domain
Message-Id: <tol0qtsm4odfmqm32rj2f3rlfu1g8bgfr5@4ax.com>
On 12 Sep 2001, rothman@pobox.com (Geoff Rothman) wrote:
>I want to use Perl (and probably a few modules) to add an account with local
>Administrator privileges called "pcadmin" to every computer in a domain. If
>it's unsuccessful, I'll print the computername to a file. I will run this
>script one time on an acct that has domain admin privileges.
>
>Can i get some help?
Why, yes. Just go on and ask a question. So far I only see a job
description. What's your particular Perl problem with this?
Puzzled,
--
use strict;my($i,$t,@r)=(0,'5 -.@BHJPT4acd6e2hk2lmn2o4r2s3tuz',map{ord}
split//,unpack('u*','L#`T&)QD5#0`#!!`#%1D)#08`#P05!!(3``$$"``#"0L&``('.
'"`P<!`````0$`'));$t=~s/(\d)(.)/$2x$1/eg;map{$t.=substr$t,$i,1,''while
$_--;$i++}@r;print"$t\n";# Thomas@Baetzler.de - http://baetzler.de/perl
------------------------------
Date: Thu, 13 Sep 2001 00:38:50 +0200
From: hackertito <hackertito@yahoo.com>
Subject: O Reilly online books
Message-Id: <3B9FE3FA.C3AFA30A@yahoo.com>
I found some weeks ago on http://insecurity.org/perl2/sysadmin/ some O
Reilly books...I have it on "paper format" but would prefer on
"electronic HTML format" . Perhaps someone saved it and could send to me
the files...because now the files arent on the web...
------------------------------
Date: 12 Sep 2001 15:50:12 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: O Reilly online books
Message-Id: <m1iteo58ij.fsf@halfdome.holdit.com>
>>>>> "hackertito" == hackertito <hackertito@yahoo.com> writes:
hackertito> I found some weeks ago on
hackertito> http://insecurity.org/perl2/sysadmin/ some O Reilly
hackertito> books...I have it on "paper format" but would prefer on
hackertito> "electronic HTML format" . Perhaps someone saved it and
hackertito> could send to me the files...because now the files arent
hackertito> on the web...
The files were never permitted to be online. I reported that site to
O'Reilly and had it shut down. Apparently, there was a
miscommunication about the legitimacy of providing such a site.
"Sneex" has apologized to the wronged parties and taken corrective
action.
If you want HTML files, you can get access to them legitimately at
http://safari.oreilly.com for an appropriate fee.
print "Just another Perl [book] author,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Thu, 13 Sep 2001 09:12:29 +0930
From: "Matthew Frick" <mfrick@chariot.net.au>
Subject: Re: ODBC with perl problem
Message-Id: <3b9ff1fc_2@news.chariot.net.au>
The sql returns no errors but no value either on the Max statement.
in sqlplus it returns the correct value
"gnari" <gnarinn@hotmail.com> wrote in message
news:1000236857.543306384701282.gnarinn@hotmail.com...
> In article <3b9de148$1_1@news.chariot.net.au>,
> Matthew Frick <mfrick@chariot.net.au> wrote:
> >Does anyone know why with my connection to an oracle database the
commented
> >out statement with the MAX included doesn't work yet without the MAX it
does
> >work??
>
> [code fragment with sql snipped]
>
> define doesn't work.
>
> what are the errors?
> did you try to enter the statement into the oracle tool sqlplus ?
>
> gnari
------------------------------
Date: Wed, 12 Sep 2001 22:21:46 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Perl is TOO much fun
Message-Id: <x71ylcf3si.fsf@home.sysarch.com>
>>>>> "MD" == Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> writes:
MD> Uri Guttman (uri@sysarch.com) wrote:
MD> : you shouldn't be using single letter var names and having a hash and an
MD> : array with the same name is fun but not good solid coding.
MD> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MD> that's right!
MD> @INC %INC
MD> @ARGV $ARGV
MD> :)
i never said that those were good choices either. in perl6 they will be
changed and probably not use overloaded names.
and also those are frozen. new code can have better names as you can
choose them.
and i see the :), i just wanted to clarify.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: 12 Sep 2001 17:12:35 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Perl is TOO much fun
Message-Id: <3b9ff9f3@news.victoria.tc.ca>
Uri Guttman (uri@sysarch.com) wrote:
: >>>>> "MD" == Malcolm Dew-Jones <yf110@vtn1.victoria.tc.ca> writes:
: MD> Uri Guttman (uri@sysarch.com) wrote:
: MD> : you shouldn't be using single letter var names and having a hash and an
: MD> : array with the same name is fun but not good solid coding.
: MD> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: MD> that's right!
: MD> @INC %INC
: MD> @ARGV $ARGV
: MD> :)
: i never said that those were good choices either. in perl6 they will be
: changed and probably not use overloaded names.
Well personally I will miss them. I know when I use C these days I often
wish I could do it. Allowing a name to have only one purpose feels very
restricting after using perl for a while. C++, PL/SQL, (ADA though I
don't use it, and others) allow function name overloads - it can be
confusing too, but is also considered very useful.
I have lots of code with
@foos -- the list of foos I am working with
%foos -- details about each foo
$foos -- all foos stringified for my purposes
$foo -- one foo (not a name overload, but I often have this var
when I have the others)
If you have lots of different things then giving the sets of things that
are the same the same names makes sense to me. Other people appear to
disagree I guess.
: and also those are frozen. new code can have better names as you can
: choose them.
: and i see the :), i just wanted to clarify.
: uri
: --
: Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
: SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
: Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
--
Want to access the command line of your CGI account? Need to debug your
installed CGI scripts? Transfer and edit files right from your browser?
What you need is "ispy.cgi" - visit http://nisoftware.com/ispy.cgi
------------------------------
Date: Thu, 13 Sep 2001 10:16:13 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Perl is TOO much fun
Message-Id: <zeTn7.89$Me7.1645@wa.nnrp.telstra.net>
"Malcolm Dew-Jones" <yf110@vtn1.victoria.tc.ca> wrote in message
news:3b9ff9f3@news.victoria.tc.ca...
> Uri Guttman (uri@sysarch.com) wrote:
> : MD> : you shouldn't be using single letter var names and having a hash
and an
> : MD> : array with the same name is fun but not good solid coding.
> : MD> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> I have lots of code with
> @foos -- the list of foos I am working with
> %foos -- details about each foo
> $foos -- all foos stringified for my purposes
>
> $foo -- one foo (not a name overload, but I often have this var
> when I have the others)
I also tend to do that, for example,
@lines = <IN>; # all the lines in the file (plural)
foreach my $line (@lines){ # each line (singular)
#etc
}
Though it can be confusing sometimes.
(BTW this is not advocating slurping files, just something I do sometimes).
Wyzelli
--
push@x,$_ for(a..z);push@x,' ';
@z='092018192600131419070417261504171126070002100417'=~/(..)/g;
foreach $y(@z){$_.=$x[$y]}y/jp/JP/;print;
------------------------------
Date: Wed, 12 Sep 2001 21:42:26 -0500
From: brian d foy <comdog@panix.com>
Subject: Perl Mongers Check-in
Message-Id: <comdog-16776D.21422612092001@news.panix.com>
to help the Perl community find out who is safe in New York
or DC we've put together a quickie CGI script for survivors
to say that they are okay. if you want to see the list or
add yourself to it, please see:
http://www.panix.com/~comdog/I_am_safe/checkin.cgi
on that page are links to similar pages. there is also a
story on http://use.perl.org about a list that Damain
is maintaining.
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Thu, 13 Sep 2001 01:06:22 GMT
From: "Graham W. Boyes - TOAO.net" <me@REMOVETHIStoao.net>
Subject: Re: Printing in Perl
Message-Id: <iETn7.5510$jY.86319@news1.rdc1.bc.home.com>
I'm using a Windows 98 boot disk that networks to a printer on a Windows
2000 Professional machine. I'm using the latest version of the DJGPP MS-DOS
port. The printer is connected via parallel to the Win2K Machine. I open
LPT1 like a file and print to it, but the printer won't print the data until
I hit the OK button on the printer.
Logan, be more friendly. Lighten up. Smile. Life's too short to yell and
scream at people.
GWB
> Is there some sort of information you want to give us about what
> operating system you're using and/or how you're trying to send to the
> printer (over the network, through the OS's queuing system, etc.)?
------------------------------
Date: 12 Sep 2001 21:10:56 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Printing in Perl
Message-Id: <9np4jg$ktb$1@charity.cs.utexas.edu>
In article <iETn7.5510$jY.86319@news1.rdc1.bc.home.com>,
Graham W. Boyes - TOAO.net <me@REMOVETHIStoao.net> wrote:
>I'm using a Windows 98 boot disk that networks to a printer on a Windows
>2000 Professional machine. I'm using the latest version of the DJGPP MS-DOS
>port. The printer is connected via parallel to the Win2K Machine. I open
>LPT1 like a file and print to it, but the printer won't print the data until
>I hit the OK button on the printer.
Hmm... That kind of sounds like the hard way. Why not send your print
job through a print queue?
>Logan, be more friendly. Lighten up. Smile. Life's too short to yell and
>scream at people.
I wasn't screaming, I was just being a smartass.
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: 13 Sep 2001 02:40:07 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Printing in Perl
Message-Id: <slrn9q070f.98c.damian@puma.qimr.edu.au>
Graham W. Boyes - TOAO.net chose Thu, 13 Sep 2001 01:06:22 GMT to say this:
>I'm using a Windows 98 boot disk that networks to a printer on a Windows
>2000 Professional machine. I'm using the latest version of the DJGPP MS-DOS
>port. The printer is connected via parallel to the Win2K Machine. I open
>LPT1 like a file and print to it, but the printer won't print the data until
>I hit the OK button on the printer.
What happens if you type the following from the command prompt:
echo test > lpt1:
or
type filename > lpt1:
What are you actually doing, opening a filehandle to LPT1? Maybe the
problem is buffering (enable autoflush by setting $| to 1, and look in
perlvar). Otherwise, you have enough information to do this with system()
and temporary files.
Cheers,
Damian
--
@:=grep!(m!$/|#!..$|),split//,<DATA>;@;=0..$#:;while($:=@;){$;=rand
$:--,@;[$;,$:]=@;[$:,$;]while$:;push@|,shift@;if$;[0]==@|;select$,,
$,,$,,1/80;print qq x\bxx((@;+@|)*$|++),@:[@|,@;],!@;&&$/} __END__
Just another Perl Hacker,# damian@qimr.edu.au
------------------------------
Date: Thu, 13 Sep 2001 03:40:10 GMT
From: "Graham W. Boyes - TOAO.net" <me@REMOVETHIStoao.net>
Subject: Re: Printing in Perl
Message-Id: <uUVn7.5610$jY.99170@news1.rdc1.bc.home.com>
> Hmm... That kind of sounds like the hard way. Why not send your > print
job through a print queue?
What's the best way to do that? (Translation: I don't have a clue what
that is)
> I wasn't screaming, I was just being a smartass.
Oh, then that's all right. :-) LOL!
Graham W. Boyes
------------------------------
Date: 12 Sep 2001 23:39:32 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Printing in Perl
Message-Id: <9npda4$lrr$1@charity.cs.utexas.edu>
In article <uUVn7.5610$jY.99170@news1.rdc1.bc.home.com>,
Graham W. Boyes - TOAO.net <me@REMOVETHIStoao.net> wrote:
>> Hmm... That kind of sounds like the hard way. Why not send your > print
>job through a print queue?
>What's the best way to do that? (Translation: I don't have a clue what
>that is)
I don't really know how to do that on DOS. On Unix, there's a command
"lpr" (some versions use "lp" instead). You feed it a file (or a
stream of bytes on the standard input) and -- voila -- some stuff
appears on the printer. In other words, it handles all the details of
dealing with the printer for you. I kinda assume that all operating
systems have something like that, but I may be wrong in the case of
DOS, since it's a pretty simple system.
Actually, if it's DOS, one thing I'd try is the good old naive "send a
control-Z" and see what happens. Maybe something like this:
open (PRINTER, ">LPT1:") or die horribly;
print PRINTER @junk;
print PRINTER "\x1A";
close PRINTER;
That's a total stab in the dark, but remember all I said is that I'd
try it, not that it'd work. :-)
Also note that "or die horribly" isn't very good Perl style, but I'm
feeling lazy right now.
- Logan
--
"Our grandkids love that we get Roadrunner and digital cable."
(Advertisement for Time Warner cable TV and internet access, July 2001)
------------------------------
Date: Wed, 12 Sep 2001 22:10:36 GMT
From: Dave Tweed <dtweed@acm.org>
Subject: Re: regex Q: how to exclude strings in a search?
Message-Id: <3B9FDC3C.F4ABBAAC@acm.org>
Bravan Dahn wrote:
> ... I want one which will find every tag except the ones which have a
> backslash in them, which specify 7pt font, or which specify red font.
That's well outside what's possible with a regular expression alone.
You're going to have to actually parse the tag and then make your
decision. Start checking out SGML/HTML-parsing modules on CPAN.
> Please look at my post
> regex Q: how to exclude strings in a search? (all of it this time)
Hasn't shown up on my server yet. Have you sent it?
-- Dave Tweed
------------------------------
Date: Wed, 12 Sep 2001 15:16:19 -0700
From: Bravan Dahn <unspecified@location.com>
Subject: Re: regex Q: how to exclude strings in a search?
Message-Id: <3B9FDEB3.BED9609E@location.com>
yes, I sent it almost immediately after the first post. I see it on my
server...
I'll check out CPAN, thanks!
Dave Tweed wrote:
> Bravan Dahn wrote:
> > ... I want one which will find every tag except the ones which have a
> > backslash in them, which specify 7pt font, or which specify red font.
>
> That's well outside what's possible with a regular expression alone.
> You're going to have to actually parse the tag and then make your
> decision. Start checking out SGML/HTML-parsing modules on CPAN.
>
> > Please look at my post
> > regex Q: how to exclude strings in a search? (all of it this time)
>
> Hasn't shown up on my server yet. Have you sent it?
>
> -- Dave Tweed
------------------------------
Date: Thu, 13 Sep 2001 00:56:39 GMT
From: "David Hilsee" <davidhilseenews@yahoo.com>
Subject: Re: Search and Replace and Reformat
Message-Id: <bvTn7.6239$gU.2096057@news1.rdc1.md.home.com>
>
> ------------------------
> #!/usr/bin/perl -w
> use strict;
>
> my $id; # the ID_number
> my $rec=''; # bar-separated records
>
> while ( <DATA> ) {
> next if /^ID\s/; # skip header lines
> if ( /^ID_number: (.*)/ ) {
> $id = $1; # remember the ID number
> print $rec; # output previous record
> $rec = ''; # empty out the record buffer
> }
> else {
> $rec .= join '|', $id, (split)[0..6]; # "list slice"
> $rec .= "\n";
> }
> }
> print $rec; # don't forget the one still in the buffer
>
>
> __DATA__
> ID_number: absn0002
> ID BASE TAR RE CAT ORIG_DATE O TITLE
> apc03 apc26 m88k f3 gen 1996-10-29 * CFW
> apc03 apc26 m68k f3 gen 1996-10-29 * CFW
> ID_number: snnn0005
> ID BASE TAR RE CAT ORIG_DATE O TITLE
> apc03 apc26 m88k f3 gen 1996-10-29 * CFW
> apc03 apc26 m68k f3 gen 1996-10-29 * CFW
> ------------------------
>
>
Why not just spit it out line by line, instead of holding multiple lines?
Something like...
{
local ($, , $\) = ('|', "\n");
# print with pipes in between each
# print argument (separator)
# and newlines at the end
my $id; # the ID_number
while ( <DATA> ) {
next if /^ID\s/; # skip header lines
if ( /^ID_number: (.*)/ ) {
$id = $1; # remember the ID number
}
else {
print $id, (split)[0..6]; # "list slice"
}
}
}
David Hilsee
------------------------------
Date: Wed, 12 Sep 2001 17:49:57 -0700
From: Bravan Dahn <unspecified@location.com>
Subject: tricky (?) find an replace question
Message-Id: <3BA002B5.32413FAA@location.com>
I am trying to edit a website, all at once. I am using "Advanced Find
and Replace", which has a regex-enabled advanced search. The files I'm
working on are text files, UTF-8 encoding. I'm replacing all of the font
tags, such as
<font size="+1">
<font color="000000">
<font face="Verdana, Arial, Helvetica, sans-serif">
<font face="Verdana, Arial, Helvetica, sans-serif" font size="-1">
...except:
tags which are part of a the java (these are jsp files)
tags with font tags which specify 7pt font
tags with font tags which specify red font
The java font tags contain backslashes- is excluding them actually as
simple as [^\]* ? Also, how do I use regex to ignore strings which
contain whole words? I know [^q] is going to ignore the letter q, but it
won't work with [^"hat"] or [^hat] or [^(hat)], will it?
Any help with this is highly appreciated. Thank you in advance.
-Will
will
at
tkai
dot
com
------------------------------
Date: Wed, 12 Sep 2001 23:28:02 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Using seek and print to insert data into a file.
Message-Id: <slrn9pvp15.aph.tadmc@tadmc26.august.net>
Robin Corcoran <robin_corcoran@3b2.com> wrote:
>Subject: Using seek and print to insert data into a file.
^^^^^^
^^^^^^
perldoc -q insert
"How do I change one line in a file/delete a line in a
file/insert a line in the middle of a file/append to the
beginning of a file?"
You are expected to check the Perl FAQs *before* posting to
the Perl newsgroup.
>I am trying to insert some processing instructions into an xml file at
>specified locations. I am using "seek" to jump to the desired location in
>the file, and "print" to output my processing instructions. Everything works
>like I want it to, except print is overwriting the data that is already
>there.
That is what it is supposed to do.
>I just want to insert new data, not overwrite existing data.
Then you either need to hold the entire file in memory and
write it _all_, or use a temporary file and rename() it.
>#Open the input file and store contents in a variable.
>open (INPUT,"C:/PiTest.xml");
You should always, yes *always*, check the return value from open():
open(INPUT, 'C:/PiTest.xml') or die "could not open 'C:/PiTest.xml' $!";
>@contents=<INPUT>;
>$contents = join('',@contents);
>close (INPUT);
You don't need the @contents temporary variable:
$contents = join('', <INPUT>);
But this is probably a "better" way of slurping a file:
{ local $/;
$contents = <INPUT>;
}
close(INPUT);
>#Get rid of hard returns.
>$contents=~s/\n+//g;
That can make your XML invalid, I don't recommend doing that.
<person
gender = "male">
will become:
<persongender = "male">
Oops!
>#Transfer contents of variable to new file
>open (OUTPUT, ">C:/NewPiTest.xml");
Check the return value.
>print OUTPUT $contents;
You are soooo close.
If you modified $contents before you print()ed it, you would
be all done now.
modify $contents *before* you print() it.
>#Iterate through file inserting pi's for line numbers (using seek to get to
>correct position).
>while ($Num_To_Insert > 0)
>{
> $position = $Insert_[$Num_To_Insert];
> seek (OUTPUT,$position,0);
> print OUTPUT "<?linestrt line=\"$Num_To_Insert\"?>";
Replace the 2 lines above to modify $contents:
substr($contents, $position, 0) = qq(<?linestrt line="$Num_To_Insert"?>);
_then_
print $contents;
after the loop.
> $Num_To_Insert--;
>}
>close (OUTPUT);
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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.
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 V10 Issue 1739
***************************************