[22389] in Perl-Users-Digest
Perl-Users Digest, Issue: 4610 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 23 03:06:14 2003
Date: Sun, 23 Feb 2003 00:05:08 -0800 (PST)
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, 23 Feb 2003 Volume: 10 Number: 4610
Today's topics:
Re: automating an ftp transfer <peakpeek@purethought.com>
Re: date::calc <will@com.yahoo>
Re: having PERL respond to a key press <usenet_poster_a@tranzoa.com>
Re: having PERL respond to a key press <mgjv@tradingpost.com.au>
modifying configuration file settings (david)
Re: modifying configuration file settings (Tad McClellan)
Need recommendation for e-card program/engine <Dave@Lahoti.com>
Re: Questions about perl. <flavell@mail.cern.ch>
Re: Reading tab delimited files into a hash. <me@privacy.net>
Settings timers in Perl / monitoring the passage of tim <driskill22@attbi.com>
Re: Settings timers in Perl / monitoring the passage of (Tad McClellan)
Re: Settings timers in Perl / monitoring the passage of <krahnj@acm.org>
Re: Settings timers in Perl / monitoring the passage of <driskill22@attbi.com>
Re: Simple Pattern Problem? <jeff@lee-burgin.com>
Re: Simple Pattern Problem? (Tad McClellan)
Re: Simple Pattern Problem? (Jay Tilton)
Re: Simple Pattern Problem? <jeff@lee-burgin.com>
Re: Simple Pattern Problem? <jeff@lee-burgin.com>
Re: Simple Pattern Problem? <krahnj@acm.org>
Re: Simple Pattern Problem? (Jay Tilton)
Re: Use or not to use modules [was: How do I ...] (Tad McClellan)
Re: Use or not to use modules [was: How do I ...] <goldbb2@earthlink.net>
Re: Use or not to use modules [was: How do I ...] <jurgenex@hotmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 23 Feb 2003 03:27:17 +0000
From: Sharon Grant <peakpeek@purethought.com>
Subject: Re: automating an ftp transfer
Message-Id: <3pfg5vo01sp7aooqgfrpb2oltfcrghg96k@4ax.com>
On Sun, 23 Feb 2003 10:43:13 +1100, in comp.lang.perl.misc, Martien Verbruggen <mgjv@tradingpost.com.au>
wrote:
>On Sat, 22 Feb 2003 21:19:36 +0000,
> Sharon Grant <peakpeek@purethought.com> wrote:
>> On 22 Feb 2003 12:36:23 -0800, in comp.lang.perl.misc, voigt691@netscape.net (Voigt Lander) wrote:
>>
>>>Would perl be a good tool for this??
>>
>> Probably not
>
>Nonsense.
>
>Perl, together with the Net::FTP module, is a perfectly good tool for
>this.
>
>>>I need to connect to an ftpsite each night and pull down a file
>>
>> Use a good command-line FTP client ...
>>
>> lftp
>> ncftp
>> curl
>
>And what exactly is the advantage of any of these tools above using
>Perl? These tools would have to be wrapped in a shell or Perl script
>anyway
Nonsense yourself. It's a one-line command. Perl is overkill
for such a trivial requirement
--
Sharon
------------------------------
Date: Sun, 23 Feb 2003 03:49:11 GMT
From: w i l l <will@com.yahoo>
Subject: Re: date::calc
Message-Id: <rogg5vccd7jbtckd4atsodgfjrihk0ddpk@4ax.com>
WOW, what sexy code!! I now have a great solution to a problem that's
been troubling me and I've come a little bit closer to understanding
pack/unpack.
Thanks for the post mr Goldberg!!!
- w i l l -
On Sat, 22 Feb 2003 14:43:14 -0500, Benjamin Goldberg
<goldbb2@earthlink.net> wrote:
>w i l l wrote:
>>
>> Is there a way of using date::calc or some other module to get the
>> time format 20030215 (YYYYMMDD) into Feb 15 2003 ?
>>
>> TIA!!!!!!!!!!!!!!!!
>
> my @montsh = qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
> my ($yyyy, $mm, $dd) = unpack 'a4 a2 a2', $input;
> print "$months[$mm-1] $dd $yyyy\n";
------------------------------
Date: Sat, 22 Feb 2003 18:27:10 -0800
From: Alex <usenet_poster_a@tranzoa.com>
Subject: Re: having PERL respond to a key press
Message-Id: <fUWdnRd-A8p8r8WjXTWc-w@speakeasy.net>
Martien Verbruggen wrote:
> On Sat, 22 Feb 2003 03:15:03 -0800,
> Alex <usenet_poster_a@tranzoa.com> wrote:
>
>>tyrannous@o-space.com wrote:
>>
>>>I want to have perl exit from a WHILE loop when the user presses a certain
>>>key on the keyboard
>
>>Anyway, the following module complains at startup time on 9x systems,
>>but works just fine anyway on Linux/Win9x/Win2k. The Win systems are
>>Active State Perl. Be careful with line-broken comments. Hope this
>>helps.
>
>
> Complains how, and what is the complaint?
>
> If you are going to report this with the author, try to be a bit more
> complete and informative about what the problem is.
I'm the author.
I mentioned the warning so that the OP wouldn't freak out if he saw it. No
problem if he sees the warning. No problem if not. Hmmm. Just noticed that the
warning comes out under Win2k (NT, too, probably), but not under 98. That might
be why I didn't copy/paste the warning. Running 98 only at the posting location
so I don't know what the warning is, exactly.
>
> It would also be a good idea if you provided a _small_ snippet of code
> that works on, say, Win NT or 2000, and not on 98. Not a complete
> module.
Couldn't find anthing more than top-comments to pull out of the source code that
wouldn't make it unusable by the OP.
Alex
P.S. Ugh. Why did I get involved? I just looked and the PPM package TermReadKey
seems to work good enough for government work (didn't look to find out how to do
function keys, etc., though) under a quick test from the 98 command line. Now,
I'll probably feel compelled to do a lot of clerical work to update a gob of old
code - not! :)
------------------------------
Date: Sun, 23 Feb 2003 17:55:19 +1100
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: having PERL respond to a key press
Message-Id: <slrnb5gs2m.2fm.mgjv@martien.heliotrope.home>
On Sat, 22 Feb 2003 18:27:10 -0800,
Alex <usenet_poster_a@tranzoa.com> wrote:
> Martien Verbruggen wrote:
>> On Sat, 22 Feb 2003 03:15:03 -0800,
>> Alex <usenet_poster_a@tranzoa.com> wrote:
>>
>>>tyrannous@o-space.com wrote:
>>>
>>>>I want to have perl exit from a WHILE loop when the user presses a certain
>>>>key on the keyboard
> >
>>>Anyway, the following module complains at startup time on 9x systems,
>>>but works just fine anyway on Linux/Win9x/Win2k. The Win systems are
>>>Active State Perl. Be careful with line-broken comments. Hope this
>>>helps.
>>
>>
>> Complains how, and what is the complaint?
>>
>> If you are going to report this with the author, try to be a bit more
>> complete and informative about what the problem is.
>
>
> I'm the author.
The author of Term::ReadKey. Not that posted stuff. The author of
Term::ReadKey is Jonathan Stowe.
I just mentioned that _if_ you wanted to complain about Term::ReadKey
not working on win98, that you should do so with the author (Jonathan
Stowe) of the module (Term::ReadKey), and that you should make sure that
you include a better description of the problem than what you included
in your post ("module complains at startup time").
And, if you state that a module, which most people here normally
recommend, is not doing a good job for you, you should probably justify
it a bit more than you've done until now. Maybe someone else can confirm
or deny that Term::ReadKey doesn't work on win98 (within the
restrictions mentioned in the README file that comes with the module)?
Do you maybe have some odd installation of Perl?
Martien
--
|
Martien Verbruggen | That's funny, that plane's dustin' crops
| where there ain't no crops.
|
------------------------------
Date: 22 Feb 2003 20:19:55 -0800
From: dwlepage@yahoo.com (david)
Subject: modifying configuration file settings
Message-Id: <b09a22ae.0302222019.94fe315@posting.google.com>
I need to take an existing configuration file, check to see if certain
parameters are configured (if they are not, they are commented (#)
out), if they are not, take input to configure these settings, and if
they are, prompt to overwrite. I want to be able to do this without
having to create a seperate file if possible. I suspect regex's would
be a good way to do this, but how about editing an existing file? What
is the best way to do this?
Thanks,
------------------------------
Date: Sat, 22 Feb 2003 22:58:05 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: modifying configuration file settings
Message-Id: <slrnb5gl6t.3gn.tadmc@magna.augustmail.com>
david <dwlepage@yahoo.com> wrote:
> how about editing an existing file?
perldoc -q file
"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?"
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 23 Feb 2003 01:20:30 GMT
From: "Dave Lahoti" <Dave@Lahoti.com>
Subject: Need recommendation for e-card program/engine
Message-Id: <ylV5a.2795$uD3.226672803@newssvr21.news.prodigy.com>
Hello,
Does anyone know of a good e-card engine that would work well in a Linux
environment?
Is Perl the best language for this? Or PHP?
It should be comparable to www.JustSayWow.com.
I'm also looking for similar content to the above site.
Please advise.
-Dave
------------------------------
Date: Sun, 23 Feb 2003 02:23:22 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Questions about perl.
Message-Id: <Pine.LNX.4.53.0302230219120.18657@lxplus081.cern.ch>
On Sat, Feb 22, Joe Creaney extruded TOFU onto the external scroll:
> I guess I need to learn more about programming.
And about posting to usenet.
[fullquote, including quoted sig, painlessly destroyed; f'ups set.
See also alt.humor.best-of-usenet for a recent comment from a bridge
fan. That's the card game, not the kind under which trolls lurk.]
------------------------------
Date: Sun, 23 Feb 2003 18:03:47 +1100
From: "Tintin" <me@privacy.net>
Subject: Re: Reading tab delimited files into a hash.
Message-Id: <b39rol$1il2os$1@ID-172104.news.dfncis.de>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnb5f05o.a1q.tadmc@magna.augustmail.com...
> The docs on your very old hard disk will be more applicable
> to your situation than those at perldoc.com, so you should
> use those as your first choice.
But how old do they have to be?
------------------------------
Date: Sun, 23 Feb 2003 04:32:34 GMT
From: "Jesse" <driskill22@attbi.com>
Subject: Settings timers in Perl / monitoring the passage of time
Message-Id: <C9Y5a.201633$2H6.3021@sccrnsc04>
Hello all. I wan't to monitor the passage of time in a perl script & take
actine if 'x' moutn of time has passed. I cannot do this with 'sleep' as I
need that for reoccuring checks during the normal operation of the script.
Basic actions:
o start script with timer set for 'x' seconds.
o Run main loop which sleeps for 5 - 10 seconds through in between
iterations htrough the loop.
o at the end of the loop check the pasage of time, if 'x' seconds has
passed since the program started, shutdown.
I have considered forking off a process that will just get the parent
pid & sleep for x seconds, then send SIGINT the parent. The parent would
then kill the child & itself, but this seems sloppy.... is there a better
way?
Thanks,
--jesse
------------------------------
Date: Sat, 22 Feb 2003 23:03:32 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Settings timers in Perl / monitoring the passage of time
Message-Id: <slrnb5glh4.3gn.tadmc@magna.augustmail.com>
Jesse <driskill22@attbi.com> wrote:
> I wan't to monitor the passage of time in a perl script & take
^
> actine if 'x' moutn of time has passed.
^^^ ^^ ^^
Did you spill Coke on your keyboard or something?
> o start script with timer set for 'x' seconds.
my $x = 120;
my $start = time;
> o at the end of the loop check the pasage of time, if 'x' seconds has
> passed since the program started, shutdown.
loop {
# stuff happens
exit if (time - $start) > $x;
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 23 Feb 2003 05:41:53 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Settings timers in Perl / monitoring the passage of time
Message-Id: <3E585F16.3B2F3848@acm.org>
Jesse wrote:
>
> Hello all. I wan't to monitor the passage of time in a perl script & take
> actine if 'x' moutn of time has passed. I cannot do this with 'sleep' as I
> need that for reoccuring checks during the normal operation of the script.
perldoc -q "How do I timeout a slow event"
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 23 Feb 2003 07:29:43 GMT
From: "Jesse" <driskill22@attbi.com>
Subject: Re: Settings timers in Perl / monitoring the passage of time
Message-Id: <HL_5a.205264$iG3.24162@sccrnsc02>
Thank you both, very helpful.
No coke, just no spell check either. :)
--jesse
"Jesse" <driskill22@attbi.com> wrote in message
news:C9Y5a.201633$2H6.3021@sccrnsc04...
> Hello all. I wan't to monitor the passage of time in a perl script & take
> actine if 'x' moutn of time has passed. I cannot do this with 'sleep' as I
> need that for reoccuring checks during the normal operation of the script.
>
> Basic actions:
>
> o start script with timer set for 'x' seconds.
> o Run main loop which sleeps for 5 - 10 seconds through in between
> iterations htrough the loop.
> o at the end of the loop check the pasage of time, if 'x' seconds has
> passed since the program started, shutdown.
>
> I have considered forking off a process that will just get the parent
> pid & sleep for x seconds, then send SIGINT the parent. The parent would
> then kill the child & itself, but this seems sloppy.... is there a better
> way?
>
> Thanks,
> --jesse
>
>
------------------------------
Date: Sun, 23 Feb 2003 02:04:24 GMT
From: Jeffrey Lee <jeff@lee-burgin.com>
Subject: Re: Simple Pattern Problem?
Message-Id: <BA7D6C59.C5B5%jeff@lee-burgin.com>
in article VEV5a.40054$ma2.11185080@twister.nyc.rr.com, Steve Grazzini at
s_grazzini@hotmail.com wrote on 2/22/03 5:41 PM:
> Jeffrey Lee <jeff@lee-burgin.com> writes:
>>
>> I've got the following:
>>
>> @samples = grep /$mat_type/, <INPUTFILE>;
>>
>> This gives me nothing in @samples. $mat_type is VAL CLASS 100K
>
> That's hard to believe...
>
> Maybe if you post a complete example someone
> will be able to tell you what's going on.
>
> e.g.
>
> #!/usr/bin/perl -w
>
> my $mat_type = "VAL CLASS 100K";
> my @samples = grep /$mat_type/, <DATA>;
>
> print for @samples;
>
> __END__
> VAL CLASS 200K
> VAL CLASS 100K
Which is why I've been banging my head on my desk all afternoon. Okay,
here's all the pertinent code:
open(SRCTPL,"$srctpl")||die "Source tpl file cannot be opened: $!";
@tpllines=<SRCTPL>;
close (SRCTPL);
@mat_type_lines = grep /MATERIAL_TYPE/, @tpllines;
$mat_type = $mat_type_lines[0]; #get the material type line to match.
$mat_type =~ /"/;
$mat_type = $';
$mat_type =~ s/"//;
open(SPLINF, "$splinf")||die "Sample info file cannot be opened: $!";
#Only bring in samples with the right material type
@samples = grep /$mat_type/,<SPLINF>;
close(SPLINF);
open(TESTFILE, ">test_sample_list.txt");
print TESTFILE "$mat_type\n";
foreach $samp_id (@samples) {print TESTFILE $samp_id}
close(TESTFILE);
#open the output file for the new template
open(NEWTPLFILE, ">$outfname")||die"Cannot create output file: $!";
#now split the sample info into appropriate fields to use to create the new
tpl file
for (@samples) {
($material, $study, undef, $method) = split /\t/;
$material=~ /\s/;
$samp_type = $`;
for(@newtpllines=@tpllines) {
s/xmaterialx/$material/;
s/xstudyx/$study/;
s/xmethodx/$method/;
s/xsamp_typex/$samp_type/;
}
foreach $new_line (@newtpllines) {print NEWTPLFILE $new_line}
}
close(NEWTPLFILE);
The little bit to TESTFILE is to check my sanity. Basically, it is giving
me the VAL CLASS 100K from the print $mat_type line, but nothing else. As I
said, if I replace $mat_type with VAL CLASS 100K this all works. Perhaps
pertinent is that this is MacPerl 5.2. I haven't booted over to OS X to see
if this works in the Unix environment or not.
Thanks for the help.
------------------------------
Date: Sat, 22 Feb 2003 18:52:37 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Simple Pattern Problem?
Message-Id: <slrnb5g6ql.32m.tadmc@magna.augustmail.com>
Jeffrey Lee <jeff@lee-burgin.com> wrote:
> Ah, it should work, but it doesn't.
> Any suggestions?
Post a short and complete program that we can run, as suggested
in the Posting Guidelines, and we will help you fix your program.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 23 Feb 2003 03:54:59 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Simple Pattern Problem?
Message-Id: <3e5841db.17503956@news.erols.com>
Jeffrey Lee <jeff@lee-burgin.com> wrote:
: Which is why I've been banging my head on my desk all afternoon. Okay,
: here's all the pertinent code:
Which is next to useless without some pertinent data.
Couldn't this have been simplified a bit?
: open(SRCTPL,"$srctpl")||die "Source tpl file cannot be opened: $!";
: @tpllines=<SRCTPL>;
: close (SRCTPL);
: @mat_type_lines = grep /MATERIAL_TYPE/, @tpllines;
: $mat_type = $mat_type_lines[0]; #get the material type line to match.
:
: $mat_type =~ /"/;
: $mat_type = $';
: $mat_type =~ s/"//;
Weird.
It might have be more obvious what you're trying to do there if some
sample data had been supplied. If you want to grab a quote-delimited
substring, try this instead.
($mat_type) = $mat_type =~ /"(.*)"/;
: open(SPLINF, "$splinf")||die "Sample info file cannot be opened: $!";
:
: #Only bring in samples with the right material type
: @samples = grep /$mat_type/,<SPLINF>;
[Code truncated, since anything after is not related to the problem.]
: As I said, if I replace $mat_type with VAL CLASS 100K this all works.
Then the value in $mat_type is something besides "VAL CLASS 100K".
Could there be a trailing newline on the value? I don't see any
chomp() in the code.
------------------------------
Date: Sun, 23 Feb 2003 04:02:30 GMT
From: Jeffrey Lee <jeff@lee-burgin.com>
Subject: Re: Simple Pattern Problem?
Message-Id: <BA7D8808.C5BE%jeff@lee-burgin.com>
in article 3e5841db.17503956@news.erols.com, Jay Tilton at tiltonj@erols.com
wrote on 2/22/03 7:54 PM:
> Which is next to useless without some pertinent data.
Sorry, I'm a bit limited without creating a completely faux data file. I've
looked at the chomp issue, and it does fix the immediate bug. Thanks!
The pattern which is being matched is misbehaving a bit, but I think I can
hunt that down!
> Couldn't this have been simplified a bit?
Quite a bit, I'm sure. Thanks for the tip on simplifying the substring
capture. Regex still confuses the living daylights out of me, but I don't
get to work with it much.
> : open(SRCTPL,"$srctpl")||die "Source tpl file cannot be opened: $!";
> : @tpllines=<SRCTPL>;
> : close (SRCTPL);
> : @mat_type_lines = grep /MATERIAL_TYPE/, @tpllines;
> : $mat_type = $mat_type_lines[0]; #get the material type line to match.
> :
> : $mat_type =~ /"/;
> : $mat_type = $';
> : $mat_type =~ s/"//;
>
> Weird.
>
> It might have be more obvious what you're trying to do there if some
> sample data had been supplied. If you want to grab a quote-delimited
> substring, try this instead.
> ($mat_type) = $mat_type =~ /"(.*)"/;
>
------------------------------
Date: Sun, 23 Feb 2003 04:43:53 GMT
From: Jeffrey Lee <jeff@lee-burgin.com>
Subject: Re: Simple Pattern Problem?
Message-Id: <BA7D918B.C5BF%jeff@lee-burgin.com>
in article 3e5841db.17503956@news.erols.com, Jay Tilton at tiltonj@erols.com
wrote on 2/22/03 7:54 PM:
> ($mat_type) = $mat_type =~ /"(.*)"/;
This was the key to everything, so thanks a bunch. My amateur attempt at
grabbing that quote delimited text must have left something odd in place.
Likely a newline, but this really did the trick. Thanks a bunch!
------------------------------
Date: Sun, 23 Feb 2003 05:27:26 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: Simple Pattern Problem?
Message-Id: <3E585BAF.A180628@acm.org>
Jeffrey Lee wrote:
>
> Which is why I've been banging my head on my desk all afternoon. Okay,
> here's all the pertinent code:
>
> open(SRCTPL,"$srctpl")||die "Source tpl file cannot be opened: $!";
> @tpllines=<SRCTPL>;
> close (SRCTPL);
> @mat_type_lines = grep /MATERIAL_TYPE/, @tpllines;
> $mat_type = $mat_type_lines[0]; #get the material type line to match.
> $mat_type =~ /"/;
> $mat_type = $';
> $mat_type =~ s/"//;
Since you only want the FIRST line that matches it would be more
efficient to do it like this:
open SRCTPL, $srctpl or die "$srctpl file cannot be opened: $!";
my $mat_type;
while ( <SRCTPL> ) {
if ( /MATERIAL_TYPE/ ) {
($mat_type) = /"(.+)"/;
last;
}
}
close SRCTPL;
> open(SPLINF, "$splinf")||die "Sample info file cannot be opened: $!";
>
> #Only bring in samples with the right material type
> @samples = grep /$mat_type/,<SPLINF>;
You might need quotemeta in case there are any regex meta-characters in
$mat_type.
my @samples = grep /\Q$mat_type/, <SPLINF>;
> close(SPLINF);
> open(TESTFILE, ">test_sample_list.txt");
> print TESTFILE "$mat_type\n";
> foreach $samp_id (@samples) {print TESTFILE $samp_id}
Or simply:
print TESTFILE "$mat_type\n", @samples;
> close(TESTFILE);
>
> #open the output file for the new template
> open(NEWTPLFILE, ">$outfname")||die"Cannot create output file: $!";
>
> #now split the sample info into appropriate fields to use to create the new
> tpl file
>
> for (@samples) {
> ($material, $study, undef, $method) = split /\t/;
> $material=~ /\s/;
> $samp_type = $`;
($samp_type) = $material =~ /^(\S+)/;
> for(@newtpllines=@tpllines) {
^^^^^^^^^
Where did @tpllines come from?
> s/xmaterialx/$material/;
> s/xstudyx/$study/;
> s/xmethodx/$method/;
> s/xsamp_typex/$samp_type/;
> }
>
> foreach $new_line (@newtpllines) {print NEWTPLFILE $new_line}
Or simply:
print NEWTPLFILE @newtpllines;
> }
> close(NEWTPLFILE);
John
--
use Perl;
program
fulfillment
------------------------------
Date: Sun, 23 Feb 2003 07:34:09 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Simple Pattern Problem?
Message-Id: <3e5875dd.30820607@news.erols.com>
Jeffrey Lee <jeff@lee-burgin.com> wrote:
: looked at the chomp issue, and it does fix the immediate bug. Thanks!
Cool. It's too bad all troubles aren't that quickly fixed.
Printing the value of $mat_type, i.e.
print "$mat_type\n";
was a good idea, except that whitespace characters aren't easily
spotted. One trick is to surround it with visible characters.
print ">$mat_type<\n";
That way a trailing newline is more obvious in the output.
>VAL CLASS 100K
<
This is most often used like this:
open(FOO, '<', $file) or die "Could not open '$file': $!"
Those whitespace characters will drive you bonkers if you're not
looking for them.
------------------------------
Date: Sat, 22 Feb 2003 19:04:50 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Use or not to use modules [was: How do I ...]
Message-Id: <slrnb5g7hi.32m.tadmc@magna.augustmail.com>
Andrew Lee <spamtrap@nowhere.com> wrote:
> I would not want to program C without
> libraries.
I don't believe it is possible to write a useful C program
without libraries.
Can a program that does no I/O be useful?
:-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 23 Feb 2003 01:44:36 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Use or not to use modules [was: How do I ...]
Message-Id: <3E586DD4.3D82B201@earthlink.net>
Tad McClellan wrote:
>
> Andrew Lee <spamtrap@nowhere.com> wrote:
>
> > I would not want to program C without
> > libraries.
>
> I don't believe it is possible to write a useful C program
> without libraries.
>
> Can a program that does no I/O be useful?
A turing machine?
--
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print
------------------------------
Date: Sun, 23 Feb 2003 06:38:43 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: Use or not to use modules [was: How do I ...]
Message-Id: <T%Z5a.9956$ep5.2419@nwrddc02.gnilink.net>
Benjamin Goldberg wrote:
> Tad McClellan wrote:
>> I don't believe it is possible to write a useful C program
>> without libraries.
>> Can a program that does no I/O be useful?
>
> A turing machine?
For a Turing machine (BTW: it's capital T) you are observing the band.
Therefore a Turing machine has output of some sort.
But for a C program without I/O there is nothing you could observe. Well,
unless you count CPU cycles burnt or you are using a memory dump to observe
the program output.
jue
------------------------------
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 4610
***************************************