[11067] in Perl-Users-Digest
Perl-Users Digest, Issue: 4667 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 16 01:03:55 1999
Date: Fri, 15 Jan 99 22:00:17 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 15 Jan 1999 Volume: 8 Number: 4667
Today's topics:
calling a subroutine with variables <andrew.kaplan@yale.edu>
Re: CONCLUSIVE PROOF: Cross posting <Ultima2K@NOSPAMaol.com>
Re: Downloading HTML files? (Matthew Bafford)
Re: Is perl the right choise for the following job? <ebohlman@netcom.com>
Re: MDB files and Perl. <njones@firstquadrant.com>
PC Perl system("cvs.exe"): "Fatal server error. Virtual gregpf@my-dejanews.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism topmind@technologist.com
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Re: Perl Criticism (David Formosa (aka ? the Platypus))
Re: perl for win32 development <njones@firstquadrant.com>
Re: READDIR doesn't work bluepuma@mailexcite.com
Re: Regex challenge <rick.delaney@home.com>
Re: Removing spaces from arrays... <rick.delaney@home.com>
Re: RFC: Stepper - stepping engine, used for process au <njones@firstquadrant.com>
Re: Socket in Perl - help?????? <ebohlman@netcom.com>
Re: Syntax help wanted: "use strict" and sort $a and $ (William Herrera)
Re: talking to my children <njones@firstquadrant.com>
Re: Which Perl reference book? ()
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 15 Jan 1999 22:32:49 -0500
From: "Andy Kaplan" <andrew.kaplan@yale.edu>
Subject: calling a subroutine with variables
Message-Id: <77p8dc$bbc$1@news.ycc.yale.edu>
Hi,
I'm not exactly a newbie at Perl, but I am self-taught and I know that there
are gaping holes in my knowledge. Still, I've gotten pretty far with it I'd
say, so I don't think my question is trivial. I have looked through the
entire faq for something related, but can't find it:
Basically, I want to use a variable to call a subroutine.
That is, I have,
@variables = ("first", "second");
And I have two subroutines, firstroutine and secondroutine. What I want is
something like this:
foreach $variable (@variables) {
if ($variable eq "first") {
&$variableroutine;
}
}
See? I want it to figure out the name of the appropriate subroutine on its
own. Obviously, if my situation were as simple as above I would just call
the subroutine directly but believe me, I can't do it that way. I only have
access to variables, and I want it to be general enough to figure out the
right subroutine on its own.
How can I do this with Perl?
Any help is greatly appreciated!
-Andy
Andrew Kaplan-Myrth
email: andrew.kaplan@yale.edu
ICQ Pager: http://i.am/kaplanmyrth
------------------------------
Date: Fri, 15 Jan 1999 23:20:32 -0500
From: Ultima2K <Ultima2K@NOSPAMaol.com>
Subject: Re: CONCLUSIVE PROOF: Cross posting
Message-Id: <36A0138C.664380DD@NOSPAMaol.com>
I'm not sure who started this thread and cross posted it to all these
unrelated news groups. Frankly I'm reading this thread from
sci.astro.amateur (SCIENCE-ASTRONOMY-AMATEUR). (I suspect some immature
12 year old started it and posted to news group at random just to annoy
people.)
Respond to this thead if you must or feel entertained by it, but please
out of courtesy on post only in your news group. Please remove the
unrelated news groups from the "To" field of your message. Thank you in
advance.
I appologize from cross-posting this message.
--
Good Seeing and Transparency to all
Tom
Remove "NOSPAM" from reply address to reply directly
------------------------------
Date: Fri, 15 Jan 1999 23:04:32 -0500
From: dragons@scescape.net (Matthew Bafford)
Subject: Re: Downloading HTML files?
Message-Id: <MPG.1109d9dd7123b0ce98978a@news.scescape.net>
In article <eVexOZPQ#GA.318@ntawwabp.compuserve.com>,
mwatkins@promotion4free.com pounded in the following:
=> Hi there,
=>
=> I have a list of URL's in a text file, one per line. I was wondering, how
=> could I have a script copy the source of each URL, to a text file? I know
=> there is the LWP module, and socket(), but don't really know how to use
=> them. All I need is the few lines of code to gather the source of the web
=> page, into an array.
How fancy do you want?
use LWP::Simple;
my $var = get("http://www.yoururlwouldgohereofcourse.com");
Or, if you want more control (such as some sort of progress report), look
into some of the examples included with LWP.
=> Any help would be greatly appreciated,
HTH!
=> Mike Watkins
--Matthew
------------------------------
Date: Sat, 16 Jan 1999 05:41:20 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Is perl the right choise for the following job?
Message-Id: <ebohlmanF5n14w.5rL@netcom.com>
Joeri Belis <progressdll@angelfire.com> wrote:
: Is perl the right choise for the following job?
: I want to connect to a certain site (asp pages)
: and need the extract some info from that page.
: reformat it and right it to an ascii file.
: Can perl do that easy?
As others have pointed it out, yes it can. You'll almost certainly want
to get familiar with the LWP modules, particularly LWP::Simple, which
will handle nearly all the dirty work of connecting to the remote site
and retrieving the page, and the HTML modules, particularly HTML::Parser
and some of its descendants like HTML::Filter, which will greatly
simplify the work of extracting information from the page. Do *not*
attempt to write regexes for parsing HTML; you will wind up spending far
more time than you'd spend learning to use HTML::Parser, and you will
almost certainly wind up with very fragile solutions that will require
extensive rework if even slight changes are made to the pages.
------------------------------
Date: Fri, 15 Jan 1999 19:53:03 -0800
From: Neil Jones <njones@firstquadrant.com>
To: Guy Doucet <gdoucet@ait.acl.ca>
Subject: Re: MDB files and Perl.
Message-Id: <36A00D1F.984E39C6@firstquadrant.com>
ODBC = Open DataBase Connectivity.
See the microsoft website for information about ODBC.
ODBC is accessible to perl through the Win32::ODBC module. Generally
you specify a "data source" in the operating system (via those stupid
control
panel applets). You would then write a perl program (or C++ or VB, but
those don't count) that simply creates a connection to that "data source".
The data source is 'named', so you would say
my $odbc = new Win32::ODBC 'my stupid database handle tag thingy';
and ODBC handles all the details of running SQL queries.
Well, ok, not really. Like most Microsoft products it only promises to do
that...
each driver for ODBC implements its own dialect of SQL, so you'll have to
read the documentation for the ODBC driver for your particular type of
database.
Guy Doucet wrote:
> We are running a Novell Web Server at the office, mainly for internal
> use. It is here that I have learned Perl, or tried to learn it! I have
> created a few Perl scripts (or programs?) to deal with user input
> through our web site, and return HTML documents on the fly. I basically
> use the Perl scripts to update a few tab-delimited text databases that I
> made. It works pretty good actually.
>
> But now, I need to create a program which will query a database through
> ODBC. I'm not sure what type of database it is, but I've been told that
> it can be accessed through ODBC. Does anyone know what needs to be done,
> and / or, what commands would be required to query the database through
> ODBC. Actually, can anyone tell me what ODBC is!
>
> All help appreciated greatly,
> Guy Doucet
------------------------------
Date: Sat, 16 Jan 1999 05:36:04 GMT
From: gregpf@my-dejanews.com
Subject: PC Perl system("cvs.exe"): "Fatal server error. Virtual memory exhausted."
Message-Id: <77p8g4$nnf$1@nnrp1.dejanews.com>
Hi,
I am attempting the most basic Perl wrapper script around CVS using system().
It is failing with what appears to be a Perl system() problem where memory
is being exhausted.
Can anyone think of a fix or a workaround ?
(Code and Output shown below).
I am on a PC, and have tried 2 versions of PC Perl including a very recent:
Binary build 509 provided by www.ActiveState.com
Built 13:37:15 Jan 5 1999
I am using CVS "server" protocol on a PC to a Sun Unix host.
$CVSROOT=:pserver:my_name@cvsserver:/repository
My simple goal is to wrap the command "cvs.exe co all" and retrieve
our codebase.
This command works *fine* on our codebase both directly, as well as running
under BASH, MKS sh.exe, and CMD.exe .
It just fails when run from system().
#############################
OUTPUT
##############################
---------------- FIRST RUN: -----------------------
(/bin/sh.exe BASH shell being picked up by system() )
@args= ("cvs.exe co all" );
$gExitCode= 0xffff & system(@args);
391 files gotten before aborting with:
U corp/develop/src/data/techlibs/cg21_exc.lst
cvs [server aborted]: can not reallocate 2097152 bytes
system(cvs.exe co all) returned 0x100
---------------- SECOND RUN: -----------------------
(NT shell C:\WINNT\system32\cmd.exe picked up by system() )
@args= ("cmd.exe /c cvs.exe co all" );
$gExitCode= 0xffff & system(@args);
4,228 files before aborting with:
U corp/vendor/src/Oe/lib/libOed.a.HP-UX10
U corp/vendor/src/Oe/lib/libOed.a.SunOS4
Fatal server error
Virtual memory exhausted.
Note: FIRST run performed on C: drive
Initial disk freespace= 517 meg.
Disk Freespace upon abend= 300 meg.
Note: SECOND run performed on E: drive
Initial disk freespace= 6.9 GIG
Disk Freespace upon abend= 6.9 GIG.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 16 Jan 1999 03:47:00 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77p23i$il9$1@nnrp1.dejanews.com>
In article <slrn79p4fu.34e.dformosa@godzilla.zeta.org.au>,
dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
> In article <77hjkh$490$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
> [...]
>
> >Think like a manager. They do not want to risk being stuck with
> >cryptic code that takes the follow-on guy or guydette 1 hour
> >per line to reverse engineer.
>
> Then they enforce code review.
I don't have the power to fix the management world.
>
> >Suppose you owned a business where a programmer spent 4 years
> >building all the software. The programmer suddendly quits
> >and you hire a new Perl expert. The Perl expert inspects the
> >code and realize that the system is composed of 30,000 lines
> >of code that looks something like this:
>
> What I've found is often its not the code thats crptyic, but a
> combernation of a cryptic bussness model and poor design.
>
I find all three in roughly equal proportions.
However, Cryptic code is somewhat controllable
by language selection.
> --
> Please excuse my spelling as I suffer from agraphia. See
> http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
> How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
>
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 16 Jan 1999 03:50:05 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77p29b$inm$1@nnrp1.dejanews.com>
In article <fl_aggie-1301990942590001@aggie.coaps.fsu.edu>,
fl_aggie@thepentagon.com (I R A Aggie) wrote:
> In article <itrg77.fo1.ln@magna.metronet.com>, tadmc@metronet.com (Tad
> McClellan) wrote:
>
> + I R A Aggie (fl_aggie@thepentagon.com) wrote:
> + : In article <369B85F6.B68B0E1@mail.uca.edu>, Cameron Dorey
> + : <camerond@mail.uca.edu> wrote:
> +
> + : + I thought that cartooning was done by computers now. I wonder which
> + : + brand does the drawing for Mr. Adams?
> +
Only parts of it. Decent animation requires somebody to tell
the computer exactly how each movement goes. Computers can
do a lot of in-betweening, but overuse makes the characters
seem robotic and all having the same personality.
> + : I think its the Adams Mk I, Rev 0.
> +
> +
> + Bzzzzt.
> +
> + His name is Scott, not Mark, heh, heh...
>
> Don't make me come over there...
>
> James
>
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 16 Jan 1999 04:00:21 GMT
From: topmind@technologist.com
Subject: Re: Perl Criticism
Message-Id: <77p2si$j6n$1@nnrp1.dejanews.com>
In article <k%3n2.493$il1.4607965@news3.voicenet.com>,
hex@voicenet.com (Matt Knecht) wrote:
> topmind@technologist.com <topmind@technologist.com> wrote:
> >
> > The Perl expert inspects the
> >code and realize that the system is composed of 30,000 lines
> >of code that looks something like this:
>
> It looks as though you've pasted the same comand line script togethre
> 4 times.
I actually copied it from one of the posters here and repeated it.
I wonder what they will think about your critique. This ought to
be fun.
> I've removed the duplicates (They produced syntax errors,
> anyway), and added some whitespace. Here's what we get:
>
> #!/usr/local/bin/perl -l
>
> $n=170;
>
> for( $d=2; ($d*$d) <= $n; $d += (1+($d%2)) ) {
> for( $t=0; ($n%$d) == 0; $t++ ) {
> $n = int($n / $d);
> }
>
> while( $t-- > 0 ) {
> push(@r, $d);
> }
> }
>
> if ($n > 1) {
> push(@r, $n);
> }
>
> $x = 0;
>
> map
> {
> $x +=
> (
> ($_>0) ?
> (1<<log($_-0.5)/log(2.0)+1)
> :
> 1
> )
> } @r;
>
> print "$x"
>
> __END__
>
> >Can you spell B.A.N.K.R.U.P.T.C.Y ?
>
> With a programmer like that? Sure! This code doesn't look like Perl
> to me. In fact, what this looks like is C. If you were to write this
> using the features of Perl you so dislike, you would have a much easier
> to understand script.
>
> >Of course this is an extreme example
>
> No. This looks like a contrived example. You pasted together 4
> command line scripts, and removed all the whitespace. Any language
> looks terrible when you do that.
>
> > but it happens on this and
> >smaller scales all the time.
>
> I don't think this happens all that much. At least none of the
> production code I've *ever* seen. I've approached poor code like the
> above when I first started learning Perl, but quickly outgrew that
> phase when I saw how much more expressive I could be with Perl
> constructs.
>
> >As for languages that are less abusable, consider Pascal, Java, or
> >Visual Basic.
>
> You could abuse those languages in the *exact* same manner as you have
> done with the above Perl code (Forgetting the fact that none of these
> languages will let you write one liners on the command line.).
It would look something like this, no:?
sub x (mm, t, r, i)
mm = 2
p=7
h = substr(mm,r,1)
v=mid(h,1)
doit p, m
dim q(5)
etc.
You know easily what is a function, what is an assigment, what is a
routine, etc.
>
> The only language I would think you couldn't abuse like you've shown
> would be Python, since it relies on magic whitespace.
>
> > One programmer confided in me, "I hate
> >programming in Visual Basic, but when I see
> >other's VB code, I can usually figure out
> >what is going on."
>
> Why did he say usually? Is there something wrong with the language
> that he couldn't make heads nor tails of the code?
>
> All the production Perl code I've *ever* seen I've been able to figure
> out in short order.
Perhaps you are more gifted in reading than many.
Or, perhaps you have been with Perl too long.
Many programmers use many different languages
and don't have time to become cryptology reading experts
in all.
> Why can't your programmer buddy figure out the
> VB?
Do you mean why "can't" or "can"?
>
> --
> Matt Knecht <hex@voicenet.com>
>
-tmind-
http://www.geocities.com/SiliconValley/Lab/6888/langopts.htm
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 16 Jan 1999 05:24:45 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn7a08kt.7km.dformosa@godzilla.zeta.org.au>
In article <77p1du$i5a$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <yl1zkz5v2a.fsf@windlord.stanford.edu>,
> Russ Allbery <rra@stanford.edu> wrote:
[...]
>> Which is something that one learns not to do with experience. Sure, there
>> are some experienced programmers who still aren't very good programmers,
>> but most people learn with time.
>
>Why would they learn something that there is no reward for?
There is a sence of accomplishment reward for writeing readable code.
>> Taking shortcuts that hurt code maintainability is bad programming. If
>> one is plagued by bad programming, one should hire good programmers;
>
>
>They usually do anyway because the perpetrator moves on after
>a while. Besides, you can only test for skill, not MOTIVES.
If the coder is motervated toi write bad code, then no langage is
going to stop him.
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: 16 Jan 1999 05:27:00 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn7a08p4.7km.dformosa@godzilla.zeta.org.au>
In article <77p1nn$ia2$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <slrn79oute.34e.dformosa@godzilla.zeta.org.au>,
> dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
[...]
>> I've writion very short scripts whos lifetime is only as long as they
>> remained in my history file. They purly existed to get one job done
>> and only that job, now given these have no long term intergaty why
>> should I write them in such a way?
>
>Certainly not!
>
>Perl is ideal for these kinds of tasks.
>That is not application type I am fussing about.
So what you need is some sort of switch that you can turn on when you
are doing longer application style programs that would ban the use of
dangourious code?
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: 16 Jan 1999 05:31:48 GMT
From: dformosa@zeta.org.au (David Formosa (aka ? the Platypus))
Subject: Re: Perl Criticism
Message-Id: <slrn7a0924.7km.dformosa@godzilla.zeta.org.au>
In article <77p23i$il9$1@nnrp1.dejanews.com>, topmind@technologist.com wrote:
>In article <slrn79p4fu.34e.dformosa@godzilla.zeta.org.au>,
> dformosa@zeta.org.au (David Formosa (aka ? the Platypus)) wrote:
[...]
>> Then they enforce code review.
>
>I don't have the power to fix the management world.
Then I think you are like the drunk searching in the light for his
keys because he could never find it in the dark. Your not going to
solve tghe problms of progarming by changing the nature of perl. You
have to change the management world.
[...]
>> What I've found is often its not the code thats crptyic, but a
>> combernation of a cryptic bussness model and poor design.
>
>I find all three in roughly equal proportions.
>However, Cryptic code is somewhat controllable
>by language selection.
Not realy, cryptic code can be writting in any langugage, e.g. in
COBOL which in terory would generate the most readable code, the vast
magouraty is unreadable.
I would argue that the best langange is the one that makes you feel
the best.
--
Please excuse my spelling as I suffer from agraphia. See
http://www.zeta.org.au/~dformosa/Spelling.html to find out more.
How to win arguments on usenet http://www.zeta.org.au/~dformosa/usenet.html
------------------------------
Date: Fri, 15 Jan 1999 20:15:35 -0800
From: Neil Jones <njones@firstquadrant.com>
To: eric@nafex.com
Subject: Re: perl for win32 development
Message-Id: <36A01266.2566CF69@firstquadrant.com>
Eric Smith wrote:
> Hello Perl
>
> I am currently developing a commericial pallet tracking logistics
> application. It is my wish to port this project to Perl - more likely at
> some future stage than now.
>
> The question: How suitable is perl as an environment for developing major
> end-user commercial applications for the win32 platform? Is the new JPL
> the front-end and is the technology of supplying compiled code (for obvious
> reasons in a commercial app.) sufficiently refined?
>
There are many options for using GUIs in perl -- research Perl/Tk, or some of
the Windows extensions for Perl. Also, keep in mind that you could use a
windows web server and do the whole thing as an intranet application...
>
> In a line: Is it feasible to dump Delphi, VB, Clarion etc for perl either
> now or will it be at some time in the near future?
>
Absolutely. It will also take less time to write and be easier to maintain in
the future.
------------------------------
Date: Sat, 16 Jan 1999 03:46:31 GMT
From: bluepuma@mailexcite.com
Subject: Re: READDIR doesn't work
Message-Id: <77p22l$il3$1@nnrp1.dejanews.com>
> Can anyone tellme why this doesn't work
> opendir(THISDIR, ".") || die " Can't open $dir";
> local(@filenames) = readdir(THISDIR) || die " can't read $dir";
> closedir(THISDIR);
> print "@filenames\n";
I tried it this way and it works:
local @files;
opendir DIRHANDLE, $dir or die "Error reading dir $dir: $!";
@files = grep !/^\./, readdir DIRHANDLE;
closedir DIRHANDLE;
regards Michael
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 16 Jan 1999 05:52:40 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Regex challenge
Message-Id: <36A02B01.D8ACB279@home.com>
[posted & mailed]
Ilya Zakharevich wrote:
>
> [A complimentary Cc of this posting was sent to Eric Smith
> <eric@nafex.com>],
> who wrote in article <slrn79ueln.2m2.eric@eric.nafex.com>:
[want to match floating & in 'table', eg. 'tab&le']
> > any elegant solutions for my regex?
>
> Not with the current pitiful state of the REx engine. But with the
> proposed onion-rings syntax (see clp.moder) and it can be done as
>
> (?<> ( (\&)? t (\&)? a (\&)? b (\&)? l (\&)? e (\&)? )
> <> ( \A \w* \&? \w* \z)
> )
I hope it's not too late to give opinions on this new syntax. As long
as I think of this in terms of onion-rings then <> isn't too bad since
it's sort of ring shaped.
But stacking the "rings" doesn't indicate nesting to me. I would prefer
to think of testing the result of matching the first pattern,
(\&)? t (\&)? a (\&)? b (\&)? l (\&)? e (\&)?
say, 'tab&le'
to see if it contains the second pattern,
\A \w* \&? \w* \z
i.e. 'tab&le' =~ /\A \w* \&? \w* \z/x;
I wonder if something like this might be more readable.
(?<> ( (\&)? t (\&)? a (\&)? b (\&)? l (\&)? e (\&)? )
~ ( \A \w* \&? \w* \z)
)
or even
(?"" ( (\&)? t (\&)? a (\&)? b (\&)? l (\&)? e (\&)? )
~ ( \A \w* \&? \w* \z)
)
since what we're essentially talking about is binding the second
*pattern* to the first *string* (result of first pattern).
I have no idea what complications might come of this, or whether it
would seem logical to other minds, or whether you've already thought of
and rejected this symbolism. But here is one opinion anyway.
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Sat, 16 Jan 1999 04:57:18 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Removing spaces from arrays...
Message-Id: <36A01DFC.BDBE714E@home.com>
[posted & mailed]
Hawkwynd wrote:
>
> An example of the data file :
>
> 6600151 Y R SF00 01/12/99 08:27 A359 ADIC
[snip]
> This is how I want the data to be outputted...
>
> 6600151|Y|R|R|SF00|01/12/99|08:27|A359|ADIC
In addition to the split/join suggestion you could try a substitute,
$line =~ s/\s+/|/g;
or a translation,
$line =~ tr/[ \t]/|/s;
but unlike split/join, both of these will put an extra '|' on the end if
there is trailing whitespace.
perldoc perlop
perldoc perlre
--
Rick Delaney
rick.delaney@shaw.wave.ca
------------------------------
Date: Fri, 15 Jan 1999 20:10:02 -0800
From: Neil Jones <njones@firstquadrant.com>
To: Tim Chambers <tbc@col.hp.com>
Subject: Re: RFC: Stepper - stepping engine, used for process automation
Message-Id: <36A0111A.5FD7F5AC@firstquadrant.com>
Well, I did something similar, but with a different intent. My solution
involved
a less theoretical approach. I had task.pm, with
sub task; sub succeed; sub fail; sub finish; as an api
my $task = task {
# do stuff here
} succeed {
# do other stuff here, other tasks, maybe?
} fail {
# and so on, you get the idea
} fail {
# talk about a shitstorm!
} finish {
# cleanup
};
$task->retries(4); # try 4 times
$task->timeout(10); # 10 seconds between tries
Then, $task->run; will go through the execution of the program.
Of course, the mechanics are different, but the idea is similar. There's
no reason that the task body couldn't be 'built' in the same manner
you're describing.
It's an interesting problem, and one that comes up frequently in my
work --- we are trying to deal with event-based scheduling that includes
error checking. A framework like Stepper would be handy...we also have
some useful heterogeneous operating environment modules --- ways of
using, say, OLE from Unix in one form or another.
If you aren't protecting the package, I'd be interested in helping out
with it
in one form or another...
..Neil
Tim Chambers wrote:
> I'm wondering if anyone's doing anything related to this.
> I'd also like to know what others think of the idea. I have
> it running, but it isn't ready for submission to CPAN.
> Tim Chambers || tbc@col.hp.com (e-mail)
> Software Design Engineer || 719.590.5570 (Office phone)
> Hewlett-Packard Company || 719.590.2251 (Fax)
> Colorado Springs Division || Tools for Digital & Embedded Design
> http://www.geocities.com/Athens/3680/ (Personal Web)
> The opinions and URL recommendations stated here are my own
> and do not necessarily represent those of Hewlett-Packard.
>
------------------------------
Date: Sat, 16 Jan 1999 05:28:17 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: Socket in Perl - help??????
Message-Id: <ebohlmanF5n0J5.4oM@netcom.com>
wtsai <wtsai@ms.chttl.com.tw> wrote:
: Thank you for your attention! I finally figured it out. The problem is that
: before
: sending data to socket, I opened a file using:
: undef $/; ### read whole paragraph
Your comment is incorrect. undef()'ing $/ tells Perl's input routines to
read an *entire file* before returning. IOW, block until EOF, which in
this case means block until the sender closes the connection.
In almost all cases, if you're going to diddle with $/ you should
localize your changes within a block, so $/ will get its previous value
back automatically when you leave the block, which should contain only
those operations that actually involve reading the file.
: $*=1; ### multiple line matching
Use of $* is deprecated. Use the /m modifier on any regex that needs to
have '.' match a newline.
------------------------------
Date: Sat, 16 Jan 1999 04:57:39 GMT
From: posting.account@lookout.com (William Herrera)
Subject: Re: Syntax help wanted: "use strict" and sort $a and $b parameters...
Message-Id: <36a01ac1.80117790@news.rmi.net>
On Thu, 14 Jan 1999 10:42:45 -0500, Ala Qumsieh <aqumsieh@matrox.com>
wrote:
>I don't get any errors. That's probably a bug in your version of
>Perl. Upgrade.
>
>PS. I have perl, version 5.004_04 built for sun4-solaris
Yes, I installed perl 5.004-02 from CPAN for Win32 and found that
indeed it does not complain about undeclared $a and $b in sorts uder
use strict.
However, it also does not handle command line globbing of filename
wildcards as my old 5.001 binaries did (or as the Solaris one does).
Any suggestions? Otherwise I shall use Jason Larke's suggestion and go
back to "buggy" 5.001.
---
The above from: address is spamblocked. Use wherrera (at) lynxview (dot) com for the reply address.
------------------------------
Date: Fri, 15 Jan 1999 19:31:01 -0800
From: Neil Jones <njones@firstquadrant.com>
To: Ryan McGuigan <ryan@mail.ramresearch.com>
Subject: Re: talking to my children
Message-Id: <36A007F4.CB07273A@firstquadrant.com>
wait(), and I think there's a Posix pause().
You can also use various kill signals to play games with them.
See Camel.
..Neil
Ryan McGuigan wrote:
> I'm talking about the forked kind. Ok, say I fork off 5(or any number of
> processes really) and want to communicate(actually just listen) to them in
> whatever order they finish doing their thing.
>
> I hope this isn't an FAQ, I did look through them but couldn't find
> exactly what I was looking for.
>
> thanks,
> Ryan
------------------------------
Date: 16 Jan 1999 04:03:52 GMT
From: hdiwan@diwanh.stu.rpi.edu ()
Subject: Re: Which Perl reference book?
Message-Id: <slrn7a03qj.jo0.hdiwan@diwanh.stu.rpi.edu>
In article <77k5qr$cer$1@nnrp1.dejanews.com>, bnelissen@hotmail.com wrote:
>Programming Perl (2nd Edition)
>The Perl Cookbook
You will have to give a precise definition of best. If best is defined to mean
"most accurate" then, no, the documentation included with the Perl interpreter
is far superior to any book. If it is defined to be "most number of pages",
then I think the Perl Cookbook wins.
Bear in mind, however, that I do not own either of these books. I just use the
perldoc and usually mess with the code until it works.
--
Hasan Diwan
------------------------------
Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4667
**************************************