[24683] in Perl-Users-Digest
Perl-Users Digest, Issue: 6845 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Aug 8 03:07:20 2004
Date: Sun, 8 Aug 2004 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)
Perl-Users Digest Sun, 8 Aug 2004 Volume: 10 Number: 6845
Today's topics:
Re: [OT] Perl Developers Needed for Open-Source ATC! (Aquila Deus)
Re: any pointers please? combine words script <matthew.garrish@sympatico.ca>
Re: DB_File and File Locking -- Best Practices <null@example.net>
Re: Dijkstra and Perl (was Re: Breaking out of nested s <abigail@abigail.nl>
Extracting all img tag and surrounding text (Antonio Gulli)
Re: File::Glob - can it recurse? (Randall Perry)
Re: File::Glob - can it recurse? <uri@stemsystems.com>
find two halves of a word? <ken_sington@nospam_abcdefg.com>
Hash reference question (Kristofer Pettijohn)
Re: Hash reference question <ceo@nospam.on.net>
Re: Hash reference question (Kristofer Pettijohn)
Re: join on space instead of comma (Anno Siegel)
Joining 2 strings (Sim)
Re: Joining 2 strings <gnari@simnet.is>
Re: Joining 2 strings <jurgenex@hotmail.com>
Re: Joining 2 strings <tadmc@augustmail.com>
Re: Joining 2 strings <gogala@sbcglobal.net>
Re: need to replace one segment of an IP <matthew.garrish@sympatico.ca>
Re: need to replace one segment of an IP <kreiss3@optonline.net>
Re: partially matching a regexp (Jay Tilton)
Term::Screen and interrupting <mr@sandman.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Aug 2004 06:30:56 -0700
From: aquila_deus@yahoo.co.uk (Aquila Deus)
Subject: Re: [OT] Perl Developers Needed for Open-Source ATC!
Message-Id: <c5cfac8f.0408070530.210ccc71@posting.google.com>
peter@PSDT.com (Peter Scott) wrote in message news:<IOZQc.30882$gE.13328@pd7tw3no>...
> In article <86d6242p5f.fsf@blue.stonehenge.com>,
> merlyn@stonehenge.com (Randal L. Schwartz) writes:
> >>>>>> "Peter" == Peter Scott <peter@PSDT.com> writes:
> >
> >Peter> I've been assuming that this is a practical joke. Anyone who thinks
> >Peter> that Perl is a good choice for creating an *operational* air traffic
> >Peter> control system needs their head examined.
> >
> >It's certainly better than the ancient stuff they're using now.
> >
> >Besides, if adequately tested, there's nothing with Perl for mission
> >critical projects. I know a lot of people who consider
> >ticketmaster.com "mission critical"... especially the folks at
> >Ticketmaster. And that's all mod_perl from top to bottom... all Perl.
> >
> >So, an ATC system coded in Perl does not scare me in the slightest.
>
> Er, if Ticketmaster makes a mistake people don't die. The requirements
> that are placed by three-letter agencies on safety-of-life software are
> mind-boggling. Not sure where the full ones are but this looks like a
> step in the right direction:
> http://www.fas.org/man/dod-101/sys/ac/equip/ord_nas.htm .
>
> We *are* talking about a system for tracking aircraft through
> radar and transponder data and updating multiple distributed
> displays in real time plus handing off data between local and
> regional centers, right? I think I'd want real time interrupts
> and interrupt priority levels, for a start. Haven't seen a Perl
> interface for those yet.
>
> It appears to me that the current system exceeds 2 million lines of
> Ada, but I could be off; I'm having a hard time finding details.
> Coming up with a Perl equivalent sounds like... a lengthy project.
> The government has budgeted several $billion for replacing it but
> we can whack off one in our spare time that they'll agree to use?
>
> Or are we talking about something else?
Thanks!
------------------------------
Date: Sat, 7 Aug 2004 21:07:29 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: any pointers please? combine words script
Message-Id: <i1fRc.48339$Jq2.2267415@news20.bellglobal.com>
"Brian McCauley" <nobull@mail.com> wrote in message
news:u9oelsdsy9.fsf@wcl-l.bham.ac.uk...
>
> For a starting point read at least the SYNOPSIS in 'perldoc GCI'.
>
> Better to use CGI.pm, see the SYNOPSIS in 'perldoc GCI'.
>
> Better to use CGI.pm, see the SYNOPSIS in 'perldoc GCI'.
>
perldoc GCI? : )
Matt
------------------------------
Date: Sun, 08 Aug 2004 05:28:49 GMT
From: Rich Grise <null@example.net>
Subject: Re: DB_File and File Locking -- Best Practices
Message-Id: <lSiRc.6268$Se2.3778@nwrddc01.gnilink.net>
dan baker wrote:
> Ben Morrow <usenet@morrow.me.uk> wrote in message
...
>> not sysopen $LCK, $LockFile, O_WRONLY | O_CREAT | O_EXCL
>> # O_EXCL is supposed to be atomic
> -------------
> I dont think this will work on ActiveState perl running on a PC, will
> it?
>
I don't know the Doze-compatible perl system calls, but O_EXCL has
always been an option in MSC/DOS, AFAIK.
Good Luck!
Rich
------------------------------
Date: 07 Aug 2004 22:16:14 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Dijkstra and Perl (was Re: Breaking out of nested subroutine?)
Message-Id: <slrnchal5e.ec9.abigail@alexandra.abigail.nl>
David Combs (dkcombs@panix.com) wrote on MMMCMXCIV September MCMXCIII in
<URL:news:cf1ge0$4dn$1@reader1.panix.com>:
== In article <slrncgted8.i4t.abigail@alexandra.abigail.nl>,
== Abigail <abigail@abigail.nl> wrote:
== >Greg Bacon (gbacon@hiwaay.net) wrote on MMMCMLXXXIX September MCMXCIII in
== ><URL:news:10gsekdbaqjrpa1@corp.supernews.com>:
== >}} In article <slrncgoacb.6hs.abigail@alexandra.abigail.nl>,
== >}} Abigail <abigail@abigail.nl> wrote:
== >}}
== >}} : [...]
== >}} : BTW, I've no doubt that Mr. Dijkstra would have the same dim opinion
== >}} : about Perl as a language as he had for 'goto' as a statement.
== >}}
== >}} I'm sure you're right, but I'd be interested in seeing more about why
== >}} you think so.
== >
== >
== >That's mostly based on memories when I was still doing research at a
== >university where a lot of the members of the staff were Dijkstra adepts,
==
== Cornell? (David Gries et al were often part of his entourage,
== and I imagine that they also worshiped him as a god.)
Groningen, which has (has?) close links with Eindhoven where EWD used
to be.
== >and his (handwritten (!)) notes were faxed, copied and distributed among
== >staff members, who were supposed to study them as if it was a gospel. I
== >still think that there was a shrine dedicated to him in the small room
== >that was always closed.
==
== Years (eons) ago I attended two years of cs summer-schools
== at UC-Santa-Cruz,
== 4 weeks long, I think it was, and (just about ) *all* the "biggies"
== were there as guest lecturers or ran entire courses.
==
== E.D. was there, complete with entire entourage from both
== Amsterdam and Cornell (via Gries).
==
== Dijkstra was of course an extremely smart guy, a genius, even,
== and wanted everyone, it seemed, to know it.
I could imagine. I never met him (despite his son having been a former
neighbour and coworker of mine) but it just oozes off of his writings.
Abigail
--
perl -wle 'print prototype sub "Just another Perl Hacker" {};'
------------------------------
Date: 7 Aug 2004 09:39:36 -0700
From: gulli@ideare.com (Antonio Gulli)
Subject: Extracting all img tag and surrounding text
Message-Id: <8f53722.0408070839.305304a8@posting.google.com>
I need to extract all the img tag from an html file and all
"surrounding text", i mean a fixed window of plain text aroung eacg
img tag. Is there a way to do this using HTML::LinkExtor or
HTML::SimpleLinkExtor or do i have to use HTML::TokeParse?
------------------------------
Date: 7 Aug 2004 08:09:18 -0700
From: rgp@systame.com (Randall Perry)
Subject: Re: File::Glob - can it recurse?
Message-Id: <fac8f6c0.0408070709.76788cd9@posting.google.com>
> > But it doesn't recurse through subdirectories. Is there a better way
> > to accomplish this than by using system()?
>
Thanks for the input, but for me, the answer here is no. :-)
Calling system() is much simpler.
Adding recursive capabilities to chown(), chmod() would be ideal.
>
> I feel like I'm taking on the job of advocating this module lately.
>
> The standard File::Find module is helpful for recursing through
> directories. The non-standard File::Find::Rule and File::Finder provide
> alternate syntaxes as well.
>
> (untested)
>
> #!/usr/bin/perl
> use strict;
> use warnings;
> use File::Find
>
> my ($uid, $gid) = @ARGV; #assuming UID and GID are passed in command line.
> my @files;
>
> sub wanted{
> push @files, $File::Find::name if -f $File::Find::name;
> }
>
> find (\&wanted, '/admin/new_account_page/');
> chown $uid, $gid, @files or die "Cannot chown: $!";
>
> __END__
------------------------------
Date: Sat, 07 Aug 2004 16:20:57 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: File::Glob - can it recurse?
Message-Id: <x7hdre6ht9.fsf@mail.sysarch.com>
>>>>> "RP" == Randall Perry <rgp@systame.com> writes:
>> > But it doesn't recurse through subdirectories. Is there a better way
>> > to accomplish this than by using system()?
>>
RP> Thanks for the input, but for me, the answer here is no. :-)
RP> Calling system() is much simpler.
RP> Adding recursive capabilities to chown(), chmod() would be ideal.
no that wouldn't be ideal. perl tries to keep its system calls as
similar as possible to the real kernel calls. chmod the system call
doesn't recurse but chmod the utility can. they are different things
even if they have the same name and have overlapping functionality. it
isn't hard to use file::find and then call chmod on the results (in the
callback or on the collected results.
the best thing to do would be to write a module that does this and put
it on cpan. then it will be easy to use and everyone can enjoy the
fruits of your labor. there is a file::chmod module which handles
different modes for setting the chmod bits but it doesn't recurse. maybe
you can work with its author to add recursion to it. forking out to a
process just to recurse is not my idea of a good thing.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Sun, 08 Aug 2004 02:38:52 -0400
From: Ken Sington <ken_sington@nospam_abcdefg.com>
Subject: find two halves of a word?
Message-Id: <q4-dnSZmSpjkV4jcRVn-iQ@speakeasy.net>
is it possible to find a word that's broken?
if:
$str="hel
lo larry";
# that is, "hel" + "\n" line break + "lo larry"
and I want to find "hello" in that string.
is that possible?
or better yet:
$str = "hel$^%&*&*&lo larry";
------------------------------
Date: 08 Aug 2004 04:00:09 GMT
From: kristofer@cybernetik.net (Kristofer Pettijohn)
Subject: Hash reference question
Message-Id: <4115a549$0$3773$d5a6236f@newsreader.cybernetik.net>
I'm defining a hash similiar to what follows:
my $HASH = (
'key1' => (
'sub1' => 'key1value1',
'sub2' => 'key1value2'
),
'key2' => (
'sub1' => 'key2value1',
'sub2' => 'key2value2')
)
and I would like to pass the reference of $HASH{'key1'} to a sub. How
do I go about doing this?
Thanks!
--
Kristofer Pettijohn
kristofer@cybernetik.net
------------------------------
Date: Sun, 08 Aug 2004 04:20:01 GMT
From: ChrisO <ceo@nospam.on.net>
Subject: Re: Hash reference question
Message-Id: <RRhRc.1607$FV3.624@newssvr17.news.prodigy.com>
Kristofer Pettijohn wrote:
> I'm defining a hash similiar to what follows:
>
> my $HASH = (
> 'key1' => (
> 'sub1' => 'key1value1',
> 'sub2' => 'key1value2'
> ),
> 'key2' => (
> 'sub1' => 'key2value1',
> 'sub2' => 'key2value2')
> )
>
> and I would like to pass the reference of $HASH{'key1'} to a sub. How
> do I go about doing this?
>
First of all, define the hash properly using matching braces and not
parens and end with a semicolon:
my $hash = {
key1 => {
sub1 => 'key1value1',
sub2 => 'key1value2',
},
key2 => {
sub1 => 'key2value1',
sub2 => 'key2value2',
},
};
The quoting of the keys is not required unless you are going to include
whitespace in your key values.
To pass the key1 reference to a sub, just reference it:
subroutine( $hash->{key1} );
sub subroutine { print "$_[0]->{sub1}\n" }
-ceo
------------------------------
Date: 08 Aug 2004 04:29:26 GMT
From: kristofer@cybernetik.net (Kristofer Pettijohn)
Subject: Re: Hash reference question
Message-Id: <4115ac26$0$3772$d5a6236f@newsreader.cybernetik.net>
ChrisO <ceo@nospam.on.net> wrote:
> First of all, define the hash properly using matching braces and not
> parens and end with a semicolon:
I do -- I guess I made the mistake of using parens instead of braces..
but the semicolons are definitely in the code -- I just typed up a short
un-tested example for my question.
Thanks for your help though - I understand it now.
--
Kristofer Pettijohn
kristofer@cybernetik.net
------------------------------
Date: 7 Aug 2004 19:50:01 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: join on space instead of comma
Message-Id: <cf3bp9$8bt$1@mamenchi.zrz.TU-Berlin.DE>
David Combs <dkcombs@panix.com> wrote in comp.lang.perl.misc:
> In article <cer6vn$8is$1@mamenchi.zrz.TU-Berlin.DE>,
> Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
>
> SNIP
>
>
> >If you have to extract fields of fixed length at fixed positions,
> >the unpack() function is the right tool. It can extract multiple
> >substrings in one step.
> >
> >"pack" and "unpack" and their formats are a sub-language of its own.
> >No-one memorizes all of it, but a few idioms are worth memorizing.
> >One is, to extract a substring of length $length at position $pos,
> >the unpack template is "@${pos}a$length". Putting it all together,
> >your solution becomes
> >
> > chomp( my @lines = <DATA>);
> > for ( @lines ) {
> > my @fields = unpack( '@7a7 @39a10 @63a*', $_);
> > print join( ', ', @fields), "\n";
> > }
> >
> >Anno
>
>
> Anno -- what are the *other* pack-unpack idioms you think worth
> memorizing?
>
> I bet lots of people here would like to see what you've got!
Not all that much, come to think of it. There's the bit-counting "%32b*",
but that is advertised right in the unpack doc and needs no promotion.
I use that one even more frequently than the substr() replacement,
but I may be inordinately fond of bit tables.
Other things thing to keep in mind about pack/unpack (though not idioms)
is the possibility of reading the length of a field from the data itself
(the "/" construct). Tassilo has also pointed this out.
Then there's the use of grouping parentheses in a template, which applies
a repeat count to a group of sub-templates at once. In the form
"(<composite template>)*" this is slightly more that syntactic sugar.
Together with the knowledge what pack/unpack generally are about, this
pretty much outlines the range of their applicability. The details
can be looked up when you decide one or the other is a likely candidate.
Very few template characters deserve to be known by heart, maybe
b - a single bit
a - a binary byte
i - a native integer (native to your C compiler)
Anno
------------------------------
Date: 7 Aug 2004 13:46:07 -0700
From: selena_kid@yahoo.com (Sim)
Subject: Joining 2 strings
Message-Id: <82bbfd98.0408071246.297ca742@posting.google.com>
Hi! Thanks for looking at my problem. I have a problem with joining 2
strings together.
Here is the problem:
I read a file into perl line by line. Each line becomes a string
element in an array. I need to recognize the first, second and third
elements of the array and join them on a single line in the output;
then join the fourth,fifth and sixth elements on the second line. My
inital plan was to use the join() function, but I had problems. The
join function does not join 2 strings on the same line. Can someone
help?(Pardon me if this is supposed to be an easy problem. I am new to
Perl)
My current stage:
my $n;
$n= 1;
open (FILE, 'sample.out');
while (defined ($_ = <FILE>)){
if ($n < 4){
$array[$n] = $_;
print join(' ',$array[$n], $array[$n+1]);#does not
work
print join(' ',@array); #does not work too
$n = $n +1 ;
}
else {
print $_;
print "time for next line";
$n =1;
}
}
close FILE;
------------------------------
Date: Sat, 7 Aug 2004 21:01:06 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Joining 2 strings
Message-Id: <cf3fqq$b2l$1@news.simnet.is>
"Sim" <selena_kid@yahoo.com> wrote in message
news:82bbfd98.0408071246.297ca742@posting.google.com...
>
> My current stage:
>
> my $n;
> $n= 1;
> open (FILE, 'sample.out');
> while (defined ($_ = <FILE>)){
at this stage $_ contains the end of line character(s)
remove it with chomp;
chomp;
add the "\n" to every print after this
> if ($n < 4){
> $array[$n] = $_;
> print join(' ',$array[$n], $array[$n+1]);#does not
> work
this does not work because array[$n+1] is not defined at this stage
> print join(' ',@array); #does not work too
define 'does not work'. do you mean the newlines?
try again
gnari
------------------------------
Date: Sat, 07 Aug 2004 21:22:25 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Joining 2 strings
Message-Id: <lKbRc.4732$114.914@nwrddc02.gnilink.net>
Sim wrote:
> Hi! Thanks for looking at my problem. I have a problem with joining 2
> strings together.
>
> Here is the problem:
>
> I read a file into perl line by line. Each line becomes a string
> element in an array.
I am not sure if putting the strings into an array is part of your
requirements or part of an attempt to solve your underlying problem
> I need to recognize the first, second and third
> elements of the array and join them on a single line in the output;
> then join the fourth,fifth and sixth elements on the second line. My
> inital plan was to use the join() function, but I had problems. The
> join function does not join 2 strings on the same line. Can someone
> help?(Pardon me if this is supposed to be an easy problem. I am new to
> Perl)
Because in this part you don't talk about the array any more but instead you
are talking about strings and lines.
You need to be careful about what you are talking about. "Lines", "strings",
and "array elements" are quite different entities.
For example join() doesn't know and doesn't care about of lines. It takes
whatever the array contains and just concatenates it.
If those text pieces happen to be lines, then you will get a single string
containing multiple lines.
I'm assuming that you simply want to print every three lines as one single
line.
> open (FILE, 'sample.out');
> unless while (defined ($_ = <FILE>)){
> if ($n < 4){
> $array[$n] = $_;
> print join(' ',$array[$n], $array[$n+1]);#does not
> work
> print join(' ',@array); #does not work too
[rest of script snipped]
You are not removing the newline character anywhere. Therefore even after
you join the lines into a single string, they are still three lines, just
packed into a single string.
You should be able to do something similar to this (untested, just to give
you an idea):
open (FILE, 'sample.out');
unless (eof FILE){ #warning: not stable; will fail if number of lines in
file is not dividable by 3
print chomp(<FILE>) . chomp(<FILE>) . <FILE>;
}
close FILE;
Or
open (FILE, 'sample.out');
while (<FILE>){
chomp; print;
print "\n" unless ($. % 3)
}
close FILE;
jue
------------------------------
Date: Sat, 7 Aug 2004 17:04:11 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Joining 2 strings
Message-Id: <slrnchaker.phi.tadmc@magna.augustmail.com>
Sim <selena_kid@yahoo.com> wrote:
> open (FILE, 'sample.out');
You should always, yes *always*, check the return value from open():
open (FILE, 'sample.out') or die "could not open 'sample.out' $!";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 07 Aug 2004 21:53:27 -0400
From: Mladen Gogala <gogala@sbcglobal.net>
Subject: Re: Joining 2 strings
Message-Id: <pan.2004.08.08.01.53.25.866276@sbcglobal.net>
On Sat, 07 Aug 2004 13:46:07 -0700, Sim wrote:
> Hi! Thanks for looking at my problem. I have a problem with joining 2
> strings together.
>
> Here is the problem:
>
> I read a file into perl line by line. Each line becomes a string
> element in an array. I need to recognize the first, second and third
> elements of the array and join them on a single line in the output;
> then join the fourth,fifth and sixth elements on the second line. My
> inital plan was to use the join() function, but I had problems. The
> join function does not join 2 strings on the same line. Can someone
> help?(Pardon me if this is supposed to be an easy problem. I am new to
> Perl)
open (FILE,"<",'sample.out') || die "Cannot open sample.out:$!\n";
my @file=<FILE>;
chomp(@file);
print join(' ',@file[0..2]),"\n";
print join(' ',@file[3..5]),"\n";
close(FILE);
This, I believe, does exactly what you wanted to do.
--
A city is a large community where people are lonesome together.
------------------------------
Date: Sat, 7 Aug 2004 11:09:57 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: need to replace one segment of an IP
Message-Id: <7h6Rc.44269$Jq2.2104287@news20.bellglobal.com>
"kreiss" <kreiss3@optonline.net> wrote in message
news:pan.2004.08.06.16.05.49.197000@optonline.net...
> for an admin script, I would like to replace the fourth octet of
> an IP, ie: 192.168.0.10 would become 192.168.0.20.
>
In addition to the regex approaches already provided, you can also split and
recombine to manipulate the parts (although far more work than needed in
this case):
my $ip = '192.168.0.10';
my @octet = split(/\./, $ip);
# whatever quick and dirty manipulation/checks
$octet[3] = '20';
$ip = join('.', @octet);
Matt
------------------------------
Date: Sat, 07 Aug 2004 16:09:49 GMT
From: kreiss <kreiss3@optonline.net>
Subject: Re: need to replace one segment of an IP
Message-Id: <pan.2004.08.07.16.02.33.791000@optonline.net>
On Fri, 06 Aug 2004 12:43:46 -0400, Scott W Gifford wrote:
> kreiss <kreiss3@optonline.net> writes:
>
>> for an admin script, I would like to replace the fourth octet of
>> an IP, ie: 192.168.0.10 would become 192.168.0.20.
>>
>> there must be an easy way to do this with a scalar that I am just too
>> dense to find myself. any help would be appreciated.
>
> If you have the IP address as a string in $ip and the last octet in a
> variable called $hostnum, you could simply do
>
> $ip =~ s/\d+$/$hostnum/;
>
> -----ScottG.
that is great, thannks to all who *helped*.
------------------------------
Date: Sun, 08 Aug 2004 03:25:59 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: partially matching a regexp
Message-Id: <41159a92.22655797@news.erols.com>
Thomas Koenig <Thomas.Koenig@online.de> wrote:
: Assume I have a regexp, /^(hello)|(goodbye)$/ for example.
:
: I want to see wether a particular string matches part of that
: particular regexp, so "", "h", "he", "hel", "hell", "hello", "g",
: "go", "goo" "good", "goodb", "goodby" and "goodbye" would be ok,
: and anything else wouldn't.
:
: I could hand-craft this example easily enough, but it grows
: tedious and error-prone for more general regular expressions,
: and automation would be much preferred.
This sounds like an opportunity to abuse Perl's
(?(condition)pattern) regex feature.
#!/perl
use strict;
use warnings;
my $pat_h = buildpattern( 'hello' );
my $pat_g = buildpattern( 'goodbye' );
while(<DATA> ) {
chomp;
print "matched '$1' in '$_'\n"
if /$pat_h/ or /$pat_g/;
}
sub buildpattern {
my @lets = $_[0] =~ /./g;
my $pat;
for( 0 .. $#lets ) {
$pat .= $_ == 0 ? $lets[$_] :
$_ == 1 ? "($lets[$_])?" :
"((?($_)$lets[$_]))?"
}
return qr/(^$pat)/;
}
__DATA__
hello
helpme
haveaniceday
goodbye
goodgrief
gabbagabbahey
------------------------------
Date: Sat, 07 Aug 2004 16:50:14 +0200
From: Sandman <mr@sandman.net>
Subject: Term::Screen and interrupting
Message-Id: <mr-EDFBBC.16501407082004@individual.net>
I am using the Term::Screen module to output a percent number on a lengthy
process. Basically, it just puts XX% at position 0,0 on the screen when it is
working.
The problem with this module is that I can't ctrl-c out of a script while it is
running any longer. Do anyone know why, have a remedy or perhaps a better
suited module for my needs?
--
Sandman[.net]
------------------------------
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 6845
***************************************