[12471] in Perl-Users-Digest
Perl-Users Digest, Issue: 6071 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Jun 20 23:07:26 1999
Date: Sun, 20 Jun 99 20:00:17 -0700
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, 20 Jun 1999 Volume: 8 Number: 6071
Today's topics:
Re: Afraid to ask about Y2K! finsol@ts.co.nz
can you split a word into letters? (Weborium)
Re: converting to eps file <ak@lets-print.de>
File modification time question... <portboy@home.com>
Re: Fixed format fields: help needed! (Larry Rosler)
Re: Fixed format fields: help needed! (Larry Rosler)
Re: function to read a line & return it <zjagrantz@znrcanz.gcz.ca>
Re: function to read a line & return it (Larry Rosler)
Re: function to read a line & return it <rick.delaney@home.com>
Graphing tools for use with Perl <tanaks@yahoo.com>
Re: Interpreting MS-ASCII - anyone have a filter? (Abigail)
Re: Interpreting MS-ASCII - anyone have a filter? (Larry Rosler)
Re: Interpreting MS-ASCII - anyone have a filter? <uri@sysarch.com>
Re: Language choice for high-volume Oracle CGI interfac (Randal L. Schwartz)
newbie question... morrisTHIS@cogent.net
Re: newbie question... RABM@prodigy.net
Re: newbie question... <rick.delaney@home.com>
Re: Perl and artificial intelligence. <pautler@hawaii.edu>
Re: perlcc in Unix vishalb@my-deja.com
printing multiple lines <tfiedler@ptd.net>
Server Running Perl - Resources? <troyknight@troyknight.eurobell.co.uk>
Re: sprintf and money (Casey R Tweten)
Re: why wont this work? (Bob Trieger)
Re: why wont this work? <troyknight@troyknight.eurobell.co.uk>
Re: why wont this work? <tchrist@mox.perl.com>
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 21 Jun 1999 00:12:53 GMT
From: finsol@ts.co.nz
Subject: Re: Afraid to ask about Y2K!
Message-Id: <7kk020$s0g$1@nnrp1.deja.com>
In article <376d3bb8.12692975@nntp.ix.netcom.com>,
Orlofsky(n.o. s.p.a.m, m.a.a.m.)@ix.netcom.com (Clifford Orlofsky)
wrote:
> On Sat, 19 Jun 1999 22:46:08 GMT, finsol@ts.co.nz wrote:
>
> <snip>
> My apologies. Your description of the leap year algorythm is correct.
> I wrote my message at 3 in the morning and then went to bed. Obviously
> I was lacking sleep when I wrote my original message! When I woke up
> the next day, I realized that I had misread your paragraph. I
> immediately attempted to cancel my message, but USENET had a seven
> hour headstart.
>
> But strictly speaking, does the leap year example belong on that page?
> It's not really part of the Y2K syndrome. After all, if you're at the
> point where you want to determine leap years, don't you already have
> to successfully deal with greater than 2 digit year representations?
>
Thanks for the apology. You had me worried there about my possible
mistake as none of us are perfect. But, perhaps you could skip the
sarcasm next time you disagree with someone?
The leap year issue is part of the whole y2K compliance issue. There is
a problem with programmers having a very narrow view of the issue with
many thinking it is a design issue where a two digit year was specified
to save space. I have worked on many Y2K audits and have only found one
instance of this. In the majority of cases the Y2K issues relate to
programmer oversight. Like the general population, very few
programmers have given any thought to the fact that 2000 is just around
the corner. Oversight is the reason for the majority of the
non-compliant Perl code still posted on the internet - much of it as
recently as this year.
The specifications did not specify to use a two digit year - the
programmer just didn't think.
You have to be an idiot to get it wrong - programmers still coding
Y2K errors and not checking previous code have not taken the time to
study the problem and then reflect on the possibility that they may have
problems in their code. They think they already know about Y2K because
the media has been very simplistic in their reporting of the issue to
the general public. A simplistic approach has been necessary because
their readers do not want to know and do not need to know any of the
intricacies of the problem. This is no excuse for programmers not to
find out what they need to know.
Jocelyn Amon
--
Financial Solutions Limited
http://www.ts.co.nz/~finsol/
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: 21 Jun 1999 02:58:49 GMT
From: weborium@aol.com (Weborium)
Subject: can you split a word into letters?
Message-Id: <19990620225849.01980.00001937@ng-cc1.aol.com>
Since a single word doesn't have any delimiter, is there a way to split it up
into letters, or pull out a single letter?
I'm trying to take the first letter off a word and store it in a variable.
Thanks for any tips.
.
.
---- How Microsoft would like to deal with Linux:
"Windows has detected a faster, superior, more efficient operating system on
your computer. Do you wish to delete it?
[yes] [yes]
----------
------------------------------
Date: Mon, 21 Jun 1999 01:58:53 +0200
From: "Anja Krause" <ak@lets-print.de>
Subject: Re: converting to eps file
Message-Id: <7kjv8j$neo$1@newsreader.ipf.de>
Jonathan Stowe schrieb in Nachricht
<7kjp2c$6eq$1@gellyfish.btinternet.com>...
>You might want to use Dejanews to search for this -
>
><http://www.deja,com>
This tip was very usefully and I spent many time. Thanks lot.
Pit
------------------------------
Date: Mon, 21 Jun 1999 01:26:28 GMT
From: Mitch <portboy@home.com>
Subject: File modification time question...
Message-Id: <376D94B9.215896C4@home.com>
I'm trying to figure out when a directory (/foo) was last modified. So,
I'm doing something like this:
($mtime) = (stat '/foo')[9];
which works. However, how can I continually poll this directory - in
the background (meaning other stuff in the script can continue
executing) until I see that the modification time has changed since I
last checked, and then go and do some command (if the /foo) has been
modified?
Thanks, .mitch
------------------------------
Date: Sun, 20 Jun 1999 18:26:24 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Fixed format fields: help needed!
Message-Id: <MPG.11d7349b3e897e7989c08@nntp.hpl.hp.com>
In article <37726dfa.46999371@enews.newsguy.com> on Sun, 20 Jun 1999
22:42:52 GMT, Marcel Grunauer <marcel.grunauer@lovely.net> says...
+ On Sun, 20 Jun 1999 23:31:30 +0200 it came to pass that "Juan Riera"
+ <juanriera@mx3.redestb.es> used an obscure tool Microsoft Outlook
+ Express 5.00.2014.211 and produced 14 lines that required the
+ following response:
+ >I am new to perl. I need to format several spool files coming from an
+ >AS/400, unhappily the output format shows the minus sign after
+ >figures; I need to move it before the figures, without changing the
+ >figures column position (is a fixed field output). I mean, for
+ >example, changing
+ >12 .34- 456.0- 123
+ >to
+ >12 -.34 -456.0 123
...
+ s/([\.\d]+)-/-$1/g;
...
+ IN : 12 .34- 456.0- 123
+ OUT: 12 -.34 -456.0 123
...
+ I hope this is what you meant by fixed field output.
He gave you an explicit example of what he meant by fixed field output.
This is a lot better information than many posters provide.
Unfortunately, that's not what your regex produced.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
=
------------------------------
Date: Sun, 20 Jun 1999 18:34:05 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Fixed format fields: help needed!
Message-Id: <MPG.11d73664497a86d3989c09@nntp.hpl.hp.com>
In article <7kjtgs$m1b$1@ash.prod.itd.earthlink.net> on Mon, 21 Jun 1999
00:06:09 GMT, Bob Trieger <sowmaster@juicepigs.com> says...
> "Juan Riera" <juanriera@mx3.redestb.es> wrote:
> >I am new to perl. I need to format several spool files coming from an
> >AS/400, unhappily the output format shows the minus sign after figures; I
> >need to move it before the figures, without changing the figures column
> >position (is a fixed field output). I mean, for example, changing
> >12 .34- 456.0- 123
> >to
> >12 -.34 -456.0 123
>
> s/([\d.]+)-/-$1/g;
>
> HTH,
I don't see how it can help, because it doesn't produce the requested
output, does it?
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 20 Jun 1999 19:35:36 -0400
From: "John A. Grant" <zjagrantz@znrcanz.gcz.ca>
Subject: Re: function to read a line & return it
Message-Id: <7kjtv4$2kd8@nrn2.NRCan.gc.ca>
Rick Delaney wrote in message <376C3C67.1E3B726E@home.com>...
>John A. Grant wrote:
[...]
>> sub ReadLine{
>> LINE:
>> while(<FILE>){
>> next LINE if /^#/;
>> next LINE if !m/\S/;
> ^^^^
>Cast off those C shackles. This could also be written
>
> next LINE unless /\S/;
Yes, much better. Thanks.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Airborne Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Sun, 20 Jun 1999 18:13:18 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: function to read a line & return it
Message-Id: <MPG.11d7317c2a150593989c07@nntp.hpl.hp.com>
In article <7kjtpa$2kf5@nrn2.NRCan.gc.ca> on Sun, 20 Jun 1999 19:32:30 -
0400, John A. Grant <zjagrantz@znrcanz.gcz.ca> says...
> Larry Rosler wrote in message ...
> >In list context, 'return undef;' returns a list with one element, the
> >value of which is undef. 'return;' returns a list with no elements,
> >which is usually more appropriate.
>
> So if 'success' returns "$_", is a list with no elements
> appropriate for the converse case (failure)?
Asuming you mean by this: If 'success' returns in scalar context the
value of $_, then 'failure' should return undef. If it returned an
empty list, in scalar context the value would be the size of the list,
or 0.
> --
> John A. Grant * I speak only for myself * (remove 'z' to reply)
> Airborne Geophysics, Geological Survey of Canada, Ottawa
> If you followup, please do NOT e-mail me a copy: I will read it here
If you put a space after the two hyphens, then savvy newsreaders won't
include your signature in the response. This is a grotesque convention
(because many programs strip trailing spaces, and it's hard to see in
any case), but that's the way it is.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Mon, 21 Jun 1999 01:29:15 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: function to read a line & return it
Message-Id: <376D9527.92A7C7C3@home.com>
Abigail wrote:
>
> I'd suggest returning 4 fried chicken and a coke.
Legs or wings, honey?
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Mon, 21 Jun 1999 01:21:37 +0100
From: "T Horse" <tanaks@yahoo.com>
Subject: Graphing tools for use with Perl
Message-Id: <376d84b9@newsread3.dircon.co.uk>
I need to be able to generate graphs on my web pages, using an HPUX
platform. So far I have looked at Grafsmann but this seems a bit tricky to
use.
Does anyone have any reccomendations as to what is a good graphing packages
to use - commercial or freeware.
I would be grateful for an help received.
Please also send a reply to my email address.
Tony
------------------------------
Date: 20 Jun 1999 14:38:11 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <slrn7mqgou.k1b.abigail@alexandra.delanet.com>
Kenny McCormack (gazelle@yin.interaccess.com) wrote on MMCXIX September
MCMXCIII in <URL:news:7kj81j$83q$1@yin.interaccess.com>:
,,
,, I was wondering if anyone had actually done a full-implementation of
,, this idea - that is, one that is aware of all the MS funny chars, and
,, deals with each appropriately. I'm open to either an AWK or PERL (or,
,, lex, for matter) solution...
That would be Perl (see perlfaq1) and Awk (that's the way how Kernighan
seems to spell it, and since he's the k in Awk...).
In Perl, I would do:
#!/opt/perl/bin/perl -pw
BEGIN {
# A hash which contains the letters to be translated.
# I'm just making up some values, as I'm not familiar with
# the MS fonts.
%t = ("\x91" => "`",
"\x96" => "'",
"\x9F" => "[TM]");
}
s/([\x80-\x9F])/$t{$1} || ""/eg; # Replace all characters in the range
# 0x80 - 0x9F with their translation,
# squish it if there's no translation.
__END__
Note that this wouldn't work if there's a char you would want to
replace with 0.
Abigail
--
sub f{sprintf'%c%s',$_[0],$_[1]}print f(74,f(117,f(115,f(116,f(32,f(97,
f(110,f(111,f(116,f(104,f(0x65,f(114,f(32,f(80,f(101,f(114,f(0x6c,f(32,
f(0x48,f(97,f(99,f(107,f(101,f(114,f(10,q ff)))))))))))))))))))))))))
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sun, 20 Jun 1999 18:43:19 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <MPG.11d73890a9208038989c0a@nntp.hpl.hp.com>
In article <slrn7mqgou.k1b.abigail@alexandra.delanet.com> on 20 Jun 1999
14:38:11 -0500, Abigail <abigail@delanet.com> says...
...
> s/([\x80-\x9F])/$t{$1} || ""/eg; # Replace all characters in the range
> # 0x80 - 0x9F with their translation,
> # squish it if there's no translation.
...
> Note that this wouldn't work if there's a char you would want to
> replace with 0.
s/([\x80-\x9F])/defined $t{$1} && $t{$1}/eg;
Maybe someone should name this idiom after me. No one else seems to use
it! :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 20 Jun 1999 22:41:44 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Interpreting MS-ASCII - anyone have a filter?
Message-Id: <x7ogia8ec7.fsf@home.sysarch.com>
>>>>> "LR" == Larry Rosler <lr@hpl.hp.com> writes:
LR> In article <slrn7mqgou.k1b.abigail@alexandra.delanet.com> on 20 Jun 1999
LR> 14:38:11 -0500, Abigail <abigail@delanet.com> says...
LR> ...
>> s/([\x80-\x9F])/$t{$1} || ""/eg; # Replace all characters in the range
>> # 0x80 - 0x9F with their translation,
>> # squish it if there's no translation.
LR> ...
>> Note that this wouldn't work if there's a char you would want to
>> replace with 0.
LR> s/([\x80-\x9F])/defined $t{$1} && $t{$1}/eg;
i think s/defined/exists/ would look better. if someone mapped a hex
code to undef yours would fail but that is a stupid thing to do.
LR> Maybe someone should name this idiom after me. No one else seems
LR> to use it! :-)
i dub this the rosler substitution!
(but only if it uses exists)
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
------------------------------
Date: 20 Jun 1999 19:47:56 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Language choice for high-volume Oracle CGI interface?
Message-Id: <m1iu8ixo9v.fsf@halfdome.holdit.com>
>>>>> "Lee" == Lee Fesperman <firstsql@ix.netcom.com> writes:
Lee> Add to your list of portable CGI languages - Jive
Lee> (http://www.firstsql.com/jive/), the only one on the list
Lee> specifically for CGI programming with database.
Huh? Do you use the word "only" in a different sense than most of the
speakers of the language do?
Why isn't "Perl" on "the list"?
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: Sun, 20 Jun 1999 17:11:52 -0700
From: morrisTHIS@cogent.net
Subject: newbie question...
Message-Id: <376D8347.4DC7CEA2@cogent.net>
Given a code fragment:
opendir THEDIR, "$basepath$ARGV[0]" || die "Unable to open directory:
$!";
@allfiles = readdir THEDIR;
closedir THEDIR;
print "<p>allfiles=\"@allfiles\"</p>\n";
and on the web page it lookslike this:
allfiles=". .. 930606818.dat 930606861.dat"
I've been beating my head agains the wall all day trying to come up with
a simple, robust way to hack the top two items off the array so that
I could add a line or two ofter the print statement, then repeat the
print statement and have it produce:
allfiles="930606818.dat 930606861.dat"
Thanks a lot in advance. I'm learning perl by the deep immersion
method, trying to hack an existing script to produce something
totally different than what was intended. I've succeeded 95%
of the way, this problem is one of the few that remain.
Mike Morris
Sorry, the return address is munged to prevent spam,
remove THIS to send email.
------------------------------
Date: 20 Jun 1999 20:42:15 -0400
From: RABM@prodigy.net
Subject: Re: newbie question...
Message-Id: <un1xuv0yg.fsf@prodigy.net>
>>>>> "morris" == morrisTHIS <morrisTHIS@cogent.net> writes:
morris> Given a code fragment:
morris> opendir THEDIR, "$basepath$ARGV[0]" || die "Unable to open directory:
morris> $!";
morris> @allfiles = readdir THEDIR;
try:
@allfiles = grep ( !/\.\.?/, readdir(THEDIR));
this will exclude the . and .. files.
HTH
--
Vinny Murphy
------------------------------
Date: Mon, 21 Jun 1999 02:50:13 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: newbie question...
Message-Id: <376DA822.FB11B2BE@home.com>
[posted & mailed]
RABM@prodigy.net wrote:
>
> try:
> @allfiles = grep ( !/\.\.?/, readdir(THEDIR));
>
> this will exclude the . and .. files.
It will also exclude any other file with a "." in its name.
ITYM
@allfiles = grep ( !/^\.\.?\z/, readdir(THEDIR));
--
Rick Delaney
rick.delaney@home.com
------------------------------
Date: Sun, 20 Jun 1999 14:23:54 -1000
From: David Pautler <pautler@hawaii.edu>
Subject: Re: Perl and artificial intelligence.
Message-Id: <376D861A.4659C3C7@hawaii.edu>
David Cassell wrote:
> Abigail wrote:
> > Didn't AI die in the mid-80's, even before Perl 1 was born?
>
> Nope, just the really big HAL-in-four-years claims. Now it
> seems that any AI research useful enough to be put into apps
> is immeidately branded 'not-AI' by the AI masters.
This has been the case in AI since it began in the 50s. Scott McNealy once
defined 'technology' as "stuff that's hard to use". 'AI' might be defined
similarly as "programs we aren't quite sure how to write or even design".
I'm new to Perl, but I'm very impressed with the power of regexpr's. If
you're looking for a way to use Perl in AI, read up on pattern 'unification'
in any AI text and try to write a unifier in Perl for a rule set. As I
understand it, recursive matching (e.g. paren matching) in Perl is nontrivial
with regexpr's, so writing a unifier using primarily regexpr's could be an
interesting project.
-dp-
------------------------------
Date: Mon, 21 Jun 1999 01:15:34 GMT
From: vishalb@my-deja.com
Subject: Re: perlcc in Unix
Message-Id: <7kk3nh$t1l$1@nnrp1.deja.com>
> Perl to C compiler is bundled with the Perl 5.005 UNIX release. Your
> scripts won't be
> any faster after compilation and you will lose the Open Source idea.
Perl to C translator doesnot prohibit you from releasing your source
code.
> Anyway if you edit the C code you can get it work e times faster than
> pure Perl code (according to Tom Christiansen) =). Please correct that
> e-coefficient if it was wrong.
The source produced by perl compiler cannot be edited unless
you really know the perl internal structures and are willing to
undergo a lot of pain. Frankly, it is almost out of the question.
As for the merits of using the perl compiler in terms of increased
performance, you save on compilation time during
execution. The execution speed of compiled script would be nearly the
same, or only slightly better because of few minor optimizations.
>
> This does what you want:
>
> $ perl -MO=CC,-ofoo.c foo.pl
Not exactly, this could skip some modules.
perlcc -sav foo.pl
is easier and more likely to work and the C- source
code would be saved up in a file called foo.pl.c
>
> ++Jukka
>
> http://www.hut.fi/~jtjuslin
>
regards,
vishal
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Mon, 21 Jun 1999 00:29:55 GMT
From: "ted fiedler" <tfiedler@ptd.net>
Subject: printing multiple lines
Message-Id: <7Ifb3.2660$I72.348423@nnrp1.ptd.net>
ok what i am doing is searching for a tag in a file -- 015
when i find this tag how do i not only print the first line but the two
lines which come after it??? also i want to remove the 015???
thanks in advance...
#!/usr/bin/perl
use File::Copy;
del_old();
copy ("test3.dat","output/working");
open (TDAT, "+< output/working") ||
die"cannot open file: $!\n";
open (RECORDCOUNT, "> output/records") ||
die"cannot create a file called records: $!";
while(<TDAT>) {
if (/015/) {
print $_;
}
}
close(TDAT);
sub del_old {
$working="output/working";
$records="output/records";
unlink($working, $records);
}
------------------------------
Date: Mon, 21 Jun 1999 01:51:08 +0100
From: "Troy Knight" <troyknight@troyknight.eurobell.co.uk>
Subject: Server Running Perl - Resources?
Message-Id: <7kk23r$p3r$1@aub.eurobell.net>
This isn't the best place to ask about servers but I guess your all pretty
knowledgable about servers seeing as most people set them up when they
program in perl.
What kind of a system would be needed to run a server online for one large
website which uses up alot of cgi resources. A pop, smtp, nntp server would
also be running on the same machine with a couple of hundred users. The site
would be getting about 5000 visitors a day. I have a p166mmx with 64meg of
ram and an average speed hd.
Any ideas then anyone on whether this could cope with all that load?
------------------------------
Date: Mon, 21 Jun 1999 01:09:31 GMT
From: crt@highvision.com (Casey R Tweten)
Subject: Re: sprintf and money
Message-Id: <376d87f9.523484652@news.kiski.net>
On Sun, 20 Jun 1999 23:02:28 +0100, James Stewart
<james@britlinks.co.uk> wrote:
:In article <Pine.GSO.4.02A.9906180903450.5420-100000@user2.teleport.com>,
:Tom Phoenix <URL:mailto:rootbeer@redcat.com> wrote:
:> On Fri, 18 Jun 1999, James Stewart wrote:
:>
:> > Subject: sprintf and money
:>
:> > Can anyone point me to a place where I can find out how to zero pad
:> > numerical values so they always have two zeros after the decimal
:> > point?
printf/sprintf documentation
:I understood the theory of what sprintf is used for and how to go about
:applying it, but constructing the actual terms wasn't clear. To start
:with, I wondered if I could use something like \d*.\d\d but realised
:pretty much straight away that this wouldn't work. I looked at one
:example I had, but it was for a very different operation and I couldn't
:quite decipher it and then reapply that.
#!/usr/local/bin/perl -w
use strict;
print "Enter a number: ";
my $var = <STDIN>;
chomp $var;
print '$';
printf "%.2f", $var;
----------------
Input: 2
output: 2.00
Casey R. Tweten|HighVision Associates
Web Developer |www.highvision.com
<joke> This is 100% certified,
virus/bug free code </joke>
------------------------------
Date: Mon, 21 Jun 1999 00:27:40 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: why wont this work?
Message-Id: <7kjup7$m1b$2@ash.prod.itd.earthlink.net>
[ courtesy cc sent by mail if address not munged ]
"ted fiedler" <tfiedler@ptd.net> wrote:
>why isnt this working the file is in the same dir as the program...?
>
>
>#!/usr/bin/perl -w
>use strict;
>open(TESTFILE, "> test3_med.dat") || die"Cannot open test3_med.dat: $!\n";
>while(<TESTFILE>) {
> print"File opened successfully"; }
>close(TESTFILE);
While? You are opening the file for writing to.
You can assume that if the program didn't die that it opened the file.
But if it makes you feel better to see it on the screen, try something
like this:
open(TESTFILE, "> test3_med.dat") and
print "file opened successfully\n" or
die"Cannot open test3_med.dat: $!";
HTH
------------------------------
Date: Mon, 21 Jun 1999 01:39:37 +0100
From: "Troy Knight" <troyknight@troyknight.eurobell.co.uk>
Subject: Re: why wont this work?
Message-Id: <7kk1e8$p3g$1@aub.eurobell.net>
try using the full address to the file, sometimes servers don't understand
filenames which aren't completely written!
ted fiedler <tfiedler@ptd.net> wrote in message
news:4wdb3.2647$I72.345843@nnrp1.ptd.net...
> why isnt this working the file is in the same dir as the program...?
>
>
> #!/usr/bin/perl -w
> use strict;
> open(TESTFILE, "> test3_med.dat") || die"Cannot open test3_med.dat: $!\n";
> while(<TESTFILE>) {
> print"File opened successfully"; }
> close(TESTFILE);
>
>
>
------------------------------
Date: 20 Jun 1999 18:44:35 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: why wont this work?
Message-Id: <376d8af3@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Troy Knight" <troyknight@troyknight.eurobell.co.uk> writes:
:try using the full address to the file, sometimes servers don't understand
:filenames which aren't completely written!
"Servers"? "Servers"? When did "computers" get renamed to "servers"?
--tom
--
"Help save the world!" --Larry Wall in README
------------------------------
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 6071
**************************************