[28484] in Perl-Users-Digest
Perl-Users Digest, Issue: 9848 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Oct 14 21:05:55 2006
Date: Sat, 14 Oct 2006 18:05:04 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 14 Oct 2006 Volume: 10 Number: 9848
Today's topics:
alarm() - SIGALRM sent too eariy? bwooster47@gmail.com
Re: alarm() - SIGALRM sent too eariy? anno4000@radom.zrz.tu-berlin.de
Re: alarm() - SIGALRM sent too eariy? bwooster47@gmail.com
best perl application server? <bootiack@yahoo.com>
Re: best perl application server? anno4000@radom.zrz.tu-berlin.de
Re: best perl application server? <wahab@chemie.uni-halle.de>
Can't redirect STDOUT <sc@rimple.net>
Re: Can't redirect STDOUT <nobull67@gmail.com>
Re: CGI.pm v2.91 bug with $q->p()? <disposable12345@cableone.net>
Re: help me pass argument to the subroutine and then re <tadmc@augustmail.com>
Re: I have no problems eating cereal...after it softens <mritty@gmail.com>
Re: I have no problems eating cereal...after it softens <tadmc@augustmail.com>
Re: I have no problems eating cereal...after it softens <wahab@chemie.uni-halle.de>
Re: replace variable with same variable <bart@nijlen.com>
trouble merging files using nested loop to read files <bennie.smith@dean_of_st_louis_blues_guitar.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Oct 2006 11:32:12 -0700
From: bwooster47@gmail.com
Subject: alarm() - SIGALRM sent too eariy?
Message-Id: <1160850732.373614.126790@b28g2000cwb.googlegroups.com>
Here's some snippet of alarm usage - but if I do a alarm() for over
2000 seconds, it always gets called much earlier - 100s of seconds
early. Is alarm() not the way to get timers kicking for long duration?
use Time::HiRes qw ( time alarm );
...
$SIG{'ALRM'} = sub { $timerExpired = 1; };
...
$seconds = 6600;
alarm($seconds);
$t1 = time();
while (1) {
.... do stuff.... file read and write, no sleep() or timer calls
here....
last if ($timerexpired);
}
$t2 = time();
print "Time taken (Seconds): ", $t2-$t1;
And the time taken is much lower - more like 2000 seconds instead of
6600 seconds.
Any tips on how to debug this further, or do something else to get a
signal right on time (a second or two here and there is fine, but right
not it is totally inaccurate for times over 30 minutes, seems to work
fine for 30 minutes or less).
------------------------------
Date: 14 Oct 2006 21:42:35 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: alarm() - SIGALRM sent too eariy?
Message-Id: <4pd3ubFhpi6rU1@news.dfncis.de>
<bwooster47@gmail.com> wrote in comp.lang.perl.misc:
> Here's some snippet of alarm usage - but if I do a alarm() for over
> 2000 seconds, it always gets called much earlier - 100s of seconds
> early. Is alarm() not the way to get timers kicking for long duration?
>
> use Time::HiRes qw ( time alarm );
What do you use Time::HiRes for? Resolution isn't your problem.
> ...
> $SIG{'ALRM'} = sub { $timerExpired = 1; };
^^^^^^^^^^^^
This variable ...
> ...
> $seconds = 6600;
> alarm($seconds);
>
> $t1 = time();
>
> while (1) {
> .... do stuff.... file read and write, no sleep() or timer calls
> here....
> last if ($timerexpired);
^^^^^^^^^^^^
... and this one aren't the same.
> }
>
> $t2 = time();
>
> print "Time taken (Seconds): ", $t2-$t1;
>
> And the time taken is much lower - more like 2000 seconds instead of
> 6600 seconds.
The code you presented and the code you ran aren't the same. The
shown code wouldn't time out early, it would never time out.
I corrected your code, ran it for a half-hour and got
Time taken (Seconds): 1800.13329315186
That's close enough, so the problem seems to be on your system, not
Perl. If I remember right, an alarm (like sleep) is interrupted
when any signals hit the process. That could be what's happening for
you.
> Any tips on how to debug this further, or do something else to get a
> signal right on time (a second or two here and there is fine, but right
> not it is totally inaccurate for times over 30 minutes, seems to work
> fine for 30 minutes or less).
Check the time in the signal handler and restart the alarm if the
expected time hasn't been reached. Set the timeout flag only if
it has.
Anno
------------------------------
Date: 14 Oct 2006 17:27:29 -0700
From: bwooster47@gmail.com
Subject: Re: alarm() - SIGALRM sent too eariy?
Message-Id: <1160872049.794622.222160@b28g2000cwb.googlegroups.com>
anno4000@radom.zrz.tu-berlin.de wrote:
> > last if ($timerexpired);
> ^^^^^^^^
> ... and this one aren't the same.
This was just an example, the code used is correct, was just a typo in
my posting.
> Check the time in the signal handler and restart the alarm if the
> expected time hasn't been reached. Set the timeout flag only if
> it has.
> Anno
But that seems to defeat the purpose of using alarm, have to take of it
exiting early!
I found another script on the web, with people reporting problems:
http://www.aczoom.com/cms/software/tools/copy-video-for-given-duration
That page has a script called timed-copy.
I ran it on Fedora system (use -v -v to print debug statements)
timed-copy -v -v -m 110 < /dev/zero > /dev/null
and it invariably exits in 38.42 minutes (and not 110 minutes) - same
thing seen, in multiple runs.
I tried another script, removed the sysread/syswrite, and replaced the
while loop with just:
while (<>) { }
and then it seemed to work fine (test is still running, atleast it did
not alrm in 38.42 minutes).
But can't see any docs on why a read/write inside a while loop would
cause an early triggering of the SIGALRM signal.
------------------------------
Date: 14 Oct 2006 03:40:24 -0700
From: "gavino" <bootiack@yahoo.com>
Subject: best perl application server?
Message-Id: <1160822423.944678.11390@h48g2000cwc.googlegroups.com>
What is the best perl application server?
Or is it simply an issue of pushing what most app servers do down into
the database.
And keeping web code for querying the db and as little else as possible?
------------------------------
Date: 14 Oct 2006 14:44:30 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: best perl application server?
Message-Id: <4pcbeeFi59spU1@news.dfncis.de>
gavino <bootiack@yahoo.com> wrote in comp.lang.perl.misc:
> What is the best perl application server?
What is a perl application server?
> Or is it simply an issue of pushing what most app servers do down into
> the database.
What database?
> And keeping web code for querying the db and as little else as possible?
Come again?
Anno
------------------------------
Date: Sat, 14 Oct 2006 21:07:57 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: best perl application server?
Message-Id: <egrcr1$ram$1@mlucom4.urz.uni-halle.de>
Thus spoke anno4000@radom.zrz.tu-berlin.de (on 2006-10-14 16:44):
> gavino <bootiack@yahoo.com> wrote in comp.lang.perl.misc:
>> What is the best perl application server?
>
> What is a perl application server?
<quote origin='http://en.wikipedia.org/wiki/Application_server'>
...
Although the term Application server applies to all platforms,
it has become synonymous with the Sun Microsystems J2EE platform.
...
</quote>
>> And keeping web code for querying the db and as little else as possible?
>
> Come again?
Maybe he thinks of "MVC" implementations?
The answer could therefore include:
- Catalyst ==> http://www.catalystframework.org/
- Maypole ==> http://maypole.perl.org/
and possibly
- "Jifty", as described in 'oreillynet'
==> http://www.oreillynet.com/onlamp/blog/2006/08/hey_thats_pretty_jifty_er_nift.html
Regards
Mirco
------------------------------
Date: 14 Oct 2006 06:42:50 -0700
From: "sc" <sc@rimple.net>
Subject: Can't redirect STDOUT
Message-Id: <1160833370.727395.175790@e3g2000cwe.googlegroups.com>
I'm now reading "Network Programming w/ Perl". And I modified an
example, but can not get the same result.
The example is as following, excepted from "Network Programming w/
Perl":
#!/usr/bin/perl
# file: redirect.pl
print "Redirecting STDOUT\n";
open (SAVEOUT,">&STDOUT");
open (STDOUT,">test.txt") or die "Can't open test.txt: $!";
print "STDOUT is redirected\n";
system "date";
open (STDOUT,">&SAVEOUT");
print "STDOUT restored\n";
After running, the contents of test.txt are:
STDOUT is redirected
Sat Oct 14 21:17:30 CST 2006
Then I try to use local to get the same result, but failed. Here's my
program:
#!/usr/bin/perl
print "Redirecting STDOUT\n";
{
local *STDOUT;
open STDOUT, ">test.txt";
print "STDOUT is redirected\n";
system "date";
print "After call system()\n";
}
print "STDOUT restored\n";
After running, the output of system "date" just goto the screen! And
the contents of test.txt are:
STDOUT is redirected
After call system()
It's weird! Why the output of "system" can't goto redirected STDOUT?
TIA
-sc
------------------------------
Date: 14 Oct 2006 09:50:15 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Can't redirect STDOUT
Message-Id: <1160844615.093006.54660@f16g2000cwb.googlegroups.com>
On Oct 14, 2:42 pm, "sc" <s...@rimple.net> wrote:
> I'm now reading "Network Programming w/ Perl". And I modified an
> example, but can not get the same result.
>
> The example is as following, excepted from "Network Programming w/
> Perl":
>
> #!/usr/bin/perl
> # file: redirect.pl
>
> print "Redirecting STDOUT\n";
> open (SAVEOUT,">&STDOUT");
In modern Perl this is better written:
open ( my $saveout,'>&', *STDOUT) or die $!;
> open (STDOUT,">test.txt") or die "Can't open test.txt: $!";
>
> print "STDOUT is redirected\n";
> system "date";
>
> open (STDOUT,">&SAVEOUT");
open (STDOUT,'>&', $saveout) or die $!;
> print "STDOUT restored\n";
>
> After running, the contents of test.txt are:
>
> STDOUT is redirected
> Sat Oct 14 21:17:30 CST 2006
>
> Then I try to use local to get the same result, but failed. Here's my
> program:
>
> #!/usr/bin/perl
>
> print "Redirecting STDOUT\n";
> {
> local *STDOUT;
> open STDOUT, ">test.txt";
>
> print "STDOUT is redirected\n";
> system "date";
> print "After call system()\n";}print "STDOUT restored\n";
>
> After running, the output of system "date" just goto the screen! And
> the contents of test.txt are:
>
> STDOUT is redirected
> After call system()
>
> It's weird! Why the output of "system" can't goto redirected STDOUT?
The simple answer is because you added local *STDOUT.
The more complex answer is because there are many protocaol layers
involved in IO.
Some of these layers are in user-space and some are in kernel space.
Inside kernel space there are filehandle-like enties often called file
control blocks or some such. At the user/kernel interface there are
"file descriptors" which are non-negative integers.
Various operating system calls can be used to control the FCBs and
their associated FDs. For example dup() will associate a previously
unassociated FD with an existing FCB. open() will create a new FCB.
When a precess fork()s (or in some OSs when a process is spawned) the
new process can inherit FDs. What this means is not that the FDs are
actually shared (although this is a shorthand terminonolgy that's used)
but that the FD in the child refers to the same FCB as the parent.
The filedescriptors 0 1 and 2 have special conventional meaings
"standard in", "standard out", "standard err". When a process wants to
generate "standard output" it sends output to FD 1. And unless it's
re-open()ed FD 1 or close()d FD 1 dup2()ed FD 1 (or whatever) this will
go via the FCB that was associated with the parent's FD 1.
Now in user-space the higher level language introduces another layer of
buffering and suchlike. In Perl with have fileandles (also known as
IO-thingys). When a Perl process starts the IO-thingys identified by
*STDOUT{IO} is bound to FD 1.
When you issue open(STDOUT,...) in Perl the associated IO-thingy will
try to carry on using FD1
But if you do local(*STDOUT) you stash away the current contents of
*STDOUT{IO} and make it empty. Now when you open(STDOUT,...) you get a
new IO-thingy associated with *STDOUT{IO} but this IO-thingy is not
associated with FD 1. As far as the current Perl process is concerned
this is now the "standard output" but any child process that's created
will still think of FD 1 as standard out.
On the other hand when I say...
open ( my $saveout,'>&', *STDOUT) or die $!;
...Perl creates a new pseudo-anonymous GLOB and associuates the IO slot
of that GLOB a new IO-thingy and associates that IO-thingy with the FD
it gets from dup()ing FD 1. So in effect $saveout now retains a
pointer (of sorts) to the FCB that was your original standard output.
And when I say...
open (STDOUT,'>&', $saveout) or die $!;
...this reassociates FD 1 with the original FCB.
Of course you may want to make sure this happens on all execution paths
(which I assume is why you wanted to use local()).
use AtExit;
open ( my $saveout,'>&', *STDOUT) or die $!;
my $restoreout = AtExit->new( sub {
# Actually the or die is of dubious utility here
open (STDOUT,'>&', $saveout) or die $!;
});
------------------------------
Date: Sat, 14 Oct 2006 13:32:28 -0500
From: "rh" <disposable12345@cableone.net>
Subject: Re: CGI.pm v2.91 bug with $q->p()?
Message-Id: <12j2b8isi6odg7f@corp.supernews.com>
<evillen@gmail.com> wrote in message
news:1160644353.694348.137950@c28g2000cwb.googlegroups.com...
> I am getting a warning for reasons that I can't understand and I
> hesitantly believe may be a bug with CGI.pm v2.91
>
> Synopsis - in certain circumstances if I use the CGI.pm paragraph
> method $q->p() my program will work correctly but I get a version of
> the following warning in my webserver error.log:
>
> filename.cgi: Use of uninitialized value in join or string at (eval 19)
>
> line 15.
A paragraph is a sub-division of text not a line break. p() expects to have
content.
> If I simply substitute $q->p() with "<br>" I get no warnings.
<snip>
That's because <br> means "stop here and go to the next line"
<p> means "separate this text from the previous text"
Using <p> as a line break is wrong, so you get an error.
Rich
------------------------------
Date: Sat, 14 Oct 2006 08:43:15 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: help me pass argument to the subroutine and then return the value from that subroutine to another.
Message-Id: <slrnej1qbj.g75.tadmc@magna.augustmail.com>
hyper-sensitive <123imemyself@gmail.com> wrote:
> #!\iw-home/iw-perl/bin/iwperl -w
What is "iwperl"?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Oct 2006 05:17:56 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: I have no problems eating cereal...after it softens. Why is replacing a simple string so hard then?
Message-Id: <1160828276.396511.236350@e3g2000cwe.googlegroups.com>
samiam@mytrashmail.com wrote:
> My data file is here: http://home.comcast.net/~tankomail/preg.htm
> And a sample is at the very bottom of this post. I just want to replace
> /<form[.*]?*\/form>/ with the word "block"
That pattern is not what you think it is. It is searching for "<form",
possibly followed by either a period or a star, followed by "/form>".
Is that what you meant? I'm guessing you wanted "<form" followed by
any amount of anything, but only as much as is necessary, followed by
"/form>". That's:
/<form(.*?)\/form>/
> Basically I just want to replace all <form> </form> fields and
> everything in between with nothing, but in testing, I wanted to see my
> work so I chose the word "block" as a good simple substitute which I
> could then replace with nothing.
>
> Way Below is my base code. But here, just under is the pulled line from
> the base code that seems to be the issue:
> $orgtext = Whey; # this one right here
> $newtext = Popcorn;
If you're using those pieces of code, you must not be using warnings.
Please start doing so. They will catch 90% of the errors you're
making. In particular, they will tell you you should be quoting your
strings, not using barewords. Additionally, please make sure you use
strict, which will force you to declare your variables.
my $orgtext = 'Whey';
my $newtext = 'Popcorn';
> The above works. I reduced it to it's simplest form as a sanity check.
> Then I tried:
>
> $orgtext = /[Ww]hey/; # this one right here
> $newtext = Popcorn;
>
> But beyond the most primitive replacement, I invariably get:
>
> Use of uninitialized value in pattern match (m//) at
> C:\russ\scripts\_Master_Snippets\clean_2_input_output_file.pl line 9.
Which is the correct warning message for the line of code you typed.
You using a pattern match, but not binding the pattern match to any
variable (using the =~ operator). Therefore, you are matching that
pattern against the $_ variable. The $_ variable does not currently
have a value, and so Perl warns you to that effect.
If $orgtext is supposed to be a string that will eventually be used in
a regular expression, then make it a string:
my $orgtext = ' [Ww]hey';
If $orgtext is supposed to be a regular expression that you will
pattern match against, make it a pattern match:
my $orgtext = qr/[Ww]hey/;
> Eventually I want to try:
>
> $orgtext = /<form[.*]?*\/form>/; # this one right here
Once again, that's assigning $orgtext to be the result of matching $_
to that pattern. And once again, your pattern isn't what you think it
is. See above.
> $newtext = block;
>
> But I can't get past the staring blocks. I know this code works in
> general, but my modifications seem to break it.
No, the code really doesn't work in general. The code you claimed
worked was assigning two strings (albeit in their bareword versions) to
a variable. Then you suddenly stopped doing that and started assigning
the result of a pattern match to that variable, using the //
delimiters.
> I also tried some while (<$intext>) variations, even removing the undef
> $/ slurp line, so that the intext would receive the data line by line -
> but no luck anywhere.
"Throw it at the wall and see what sticks" is rarely a good method of
programming. Look at the warning message, figure out what it's telling
you, and research that.
> I have spent quite a bit of research time trying
> various things - but apparently it's not a trivial task.
Yes, it really is. Instead of randomly typing code without knowing
what you're doing, your "research time" would have been better spent
actually doing research. Please read some basic Perl documentation.
In this case, start with:
perldoc perlretut
> Any suggestions as to:
>
> 1.) Is my basic model okay, slurping the whole file into a variable? or
> 2.) Should I use a while <> structure?
In general, you don't want to slurp unless you actually need to. In
this case, however, you do need to, because your pattern spans more
than one line of the file. So no, you cannot use the while() loop
approach in your case.
> And even when I do get the simple Whey replaced with Popcorn - it only
> does the first instance, basically, I am guessing, because there is no
> iterative code in this script.
STOP GUESSING. READ. LEARN. Read the documentation I pointed you to
above to see how to make a s/// operation replace all instances of a
pattern. Again, it's trivial, but you are not going to learn how to do
it by just guessing and typing random characters.
> And the only iterative examples I've
> seen are not with a whole file in one "intext" variable, but always
> with a while <> structure.
Massive red herring. Examples using while(<>) would have the same
problem if the pattern appeard twice on the same line. Only the first
on each line would be replaced.
> Your input and examples are GREATLY appreciated because the red spot on
> my banging against the cubicle wall head is growing.
Your cranium would suffer less damage if you took the time to read the
documentation instead of using a trial-and-error approach.
Paul Lalli
------------------------------
Date: Sat, 14 Oct 2006 08:38:23 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: I have no problems eating cereal...after it softens. Why is replacing a simple string so hard then?
Message-Id: <slrnej1q2f.g75.tadmc@magna.augustmail.com>
samiam@mytrashmail.com <samiam@mytrashmail.com> wrote:
> My new code is still as useful as a no mouth dog at a frisbee contest:
That's because the part that is supposed to do the work is commented out.
Have you seen the Posting Guidelines that are posted here frequently?
> my $infile = 'C:\russ\weights\preg.htm';
You don't need to use silly slashes. This will work just fine:
my $infile = 'C:/russ/weights/preg.htm';
> #while ($intext) $intext = {s/$orgtext/$newtext/ms;}
^^^^ ^^^^ ^^^^ ^^^^
> # the ms is for coping correctly with newlines (that can easily appear
> in a binary).
If it is binary you should not keep calling it text.
[ snip TOFU. Please learn the proper way of composing a followup. Soon. ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 14 Oct 2006 17:56:54 +0200
From: Mirco Wahab <wahab@chemie.uni-halle.de>
Subject: Re: I have no problems eating cereal...after it softens. Why is replacing a simple string so hard then?
Message-Id: <egr1kq$o6k$1@mlucom4.urz.uni-halle.de>
Thus spoke samiam@mytrashmail.com (on 2006-10-14 02:59):
> After about 6 months more of study...I might be able to replace a
> simple string. Dang!
I tried to think about what the real problem
here is and came up with th program below,
which is, what I think - your major hurdle.
All you probably want -- can be boiled down
to the following:
use strict;
use warnings;
my $intext = q{
A B C Cereals C B A
D E Cereals E D
F G Cereals Z Z
};
my $orgtext = 'Cereals';
my $newtext = 'Samiam';
$intext =~ s/$orgtext/$newtext/g;
print "Text is now:", $intext;
print "Searching for '$newtext'\n";
while( $intext =~ /$newtext/g ) {
print "got one '$newtext' at position $+[0]\n";
}
You have a 'text file' $intext and want
to replace sth. (Cereals by Samiam) You
should probably stick to this example and
try to understand it.
Then, you may have done the first step
in solving your whole problem.
Regards
Mirco
------------------------------
Date: 14 Oct 2006 08:34:35 -0700
From: "Bart Van der Donck" <bart@nijlen.com>
Subject: Re: replace variable with same variable
Message-Id: <1160840075.680538.254410@i3g2000cwc.googlegroups.com>
Michele Dondi wrote:
> >in general I'ld say that the tendencies of my test can be trusted to
> >prove that $& is 'an sich' faster than $1 (at least as benchmarked on
> >FreeBSD and WinXP here). I'm not sure why; it's probably to do with
> >lower mechanisms at C++/compile level, which I'm not very confident
> >with.
>
> I haven't the slightest idea myself.
I had this idea that it could be because $& is the straight call to the
full pattern that was found. While $1 requires more memory because the
first part between the brackets needs to be extracted from the total
pattern. Just a feeling!
--
Bart
------------------------------
Date: Sat, 14 Oct 2006 22:56:54 GMT
From: "Dean Of St. Louis Blues" <bennie.smith@dean_of_st_louis_blues_guitar.com>
Subject: trouble merging files using nested loop to read files
Message-Id: <45316b0d$0$5938$9a6e19ea@news.newshosting.com>
Hi,
I am having a problem merging two files. The problem is when reading
the second file in a nested loop. I have posted the code below.
I have two sorted files. I open them, I (1) read the first line from the
first file, then want to (2) loop through the second file and compare
specific fields (fixed width field format). (3) When I find matching fields
it extracts data, and writes it as a record to an output file. Then it is
supposed to (4) break from the inner loop, (5) get the second record from
the first file, and then ( 6) continue scanning the second file from where
it left off, until it finds another matching record, and so on.
The problem happens at step (6). It reads the seconf file from the first
file, but doesn't seem to want to look at the second file any more. My
debugging statements show that it just keeps looping through to the end of
the first file without ever looking at the second file again.
I am rather new to perl, but have significant programming experience and
have tried to figure this out on my own. Please help before I finish
pulling all my hair out.
Thanks.
######## code example ####################
...
open (FILTERED_SORTED_SERVICE_FILE, "$sorted_service_output_filename") or
die "$! error opening $sorted_service_output_filename";
open (SORTED_BILLING_FILE, "$sorted_billing_output_filename") or die "$!
error opening at $sorted_billing_output_filename";
sub mergeFiles{
#print "merge files\n";
$scount = 1; # for debugging
$bcount = 1; # for debugging
# go through the service record file one line at a time
for $serviceRecord (<FILTERED_SORTED_SERVICE_FILE>) {
print "service record count = $scount\n"; # for debugging
# at each service record scan the billing file to find a matching
# record, do some work and get then break out and get another
# service record and repeat. Do not start at the top of the
# billing file again, just continue from before (it is a merge! :-)
for $billingRecord (<SORTED_BILLING_FILE>){
$srPayID = substr($service,21,15);
$brPayID = substr($billing,211,15);
print "billing record count = $bcount,\
srPayID = $srPayID, brPayID = $brPayID\n"; # for debugging
if ($srPayID eq $brPayID){
# next line calls the sub which does some work and returns a
# line to print to file.
my $op = extractOutputFields($serviceRecord,
$billingRecord);
print FINAL_OUTPUT_FILE $op;
# found corresponding record in billing file, break out, get
# next service record and continue scanning billing file
# where it last left off.
last;
}
$bcount = $bcount + 1; # for debugging
}
$scount = $scount + 1; # for debugging
} #end of for
}
close FILTERED_SORTED_SERVICE_FILE;
close SORTED_BILLING_FILE;
...
###### end of code example ######################
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 9848
***************************************