[30405] in Perl-Users-Digest
Perl-Users Digest, Issue: 1648 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 17 09:09:56 2008
Date: Tue, 17 Jun 2008 06:09:20 -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 Tue, 17 Jun 2008 Volume: 11 Number: 1648
Today's topics:
Re: FAQ 8.4 How do I print something out in color? madaan.hanish@gmail.com
Re: File Locked After Close? <nospam-abuse@ilyaz.org>
Help with Hash of Hashes <kncbram@mapson.hawaii.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Jun 2008 03:56:06 -0700 (PDT)
From: madaan.hanish@gmail.com
Subject: Re: FAQ 8.4 How do I print something out in color?
Message-Id: <e4592a0b-602e-4bf8-b389-c6530bfb920d@t12g2000prg.googlegroups.com>
On Jun 16, 12:03 pm, PerlFAQ Server <br...@stonehenge.com> wrote:
> This is an excerpt from the latest version perlfaq8.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is athttp://faq.perl.org.
>
> --------------------------------------------------------------------
>
> 8.4: How do I print something out in color?
>
> In general, you don't, because you don't know whether the recipient has
> a color-aware display device. If you know that they have an ANSI
> terminal that understands color, you can use the Term::ANSIColor module
> from CPAN:
>
> use Term::ANSIColor;
> print color("red"), "Stop!\n", color("reset");
> print color("green"), "Go!\n", color("reset");
>
> Or like this:
>
> use Term::ANSIColor qw(:constants);
> print RED, "Stop!\n", RESET;
> print GREEN, "Go!\n", RESET;
>
> --------------------------------------------------------------------
>
> The perlfaq-workers, a group of volunteers, maintain the perlfaq. They
> are not necessarily experts in every domain where Perl might show up,
> so please include as much information as possible and relevant in any
> corrections. The perlfaq-workers also don't have access to every
> operating system or platform, so please include relevant details for
> corrections to examples that do not work on particular platforms.
> Working code is greatly appreciated.
>
> If you'd like to help maintain the perlfaq, see the details in
> perlfaq.pod.
very cool post thanx
------------------------------
Date: Tue, 17 Jun 2008 04:31:22 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: File Locked After Close?
Message-Id: <g37emq$1mc0$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Dan Rumney
<danrumney@warpmail.new>], who wrote in article <484aeb2c$0$30171$4c368faf@roadrunner.com>:
> xmp333@yahoo.com wrote:
> > Hi,
> >
> > The last line of the following code snippet fails:
> >
> > open FILE, '<file.dat' || die '...';
> > process(FILE);
> > close FILE;
> > system('command file.dat');
> >
>
> [snip]
>
> > Any suggestions? I'm using ActiveState Perl on Windows running in a
> > DOS shell.
>
> Try checking the return code of the close function to see if there's
> some kind of problem preventing the file from closing
Checking the return code of open() would not hurt either. ;-) :-(
Hope this helps,
Ilya
------------------------------
Date: Mon, 16 Jun 2008 18:25:10 -1000
From: Kevin Brammer <kncbram@mapson.hawaii.rr.com>
Subject: Help with Hash of Hashes
Message-Id: <48573b95$0$12894$4c368faf@roadrunner.com>
I'm trying to write what I thought would be a simple script for work. I
can visualize the data structure I need in my head, but coding it is
another story. Basically, I'm parsing a text file which is the output
of a web query. The format is basically:
00-00AAAA
- string,0,0,0,0,0
- string,0,0,0,0,0
The thing is, each "item" (the 00-00AAAA) can have 0-4 entries below it,
semi-csv formatted, default value of "0".
My data structure in my head was a hash of hashes:
%HoH = ( item => {
entry1 => "0",
entry2 => "0",
entry3 => "0",
}
);
Problem is, I would like it to be dynamic enough to pull the "item" from
the file and not have to "declare" the name ahead of time. I'm using
strict, and am careful about data input and validation. So, in this
case I would have:
%HoH = ( "00-00AAAA" => {
entry1 => "string,0,0,0,0,0",
entry2 => "string,0,0,0,0,0",
entry3 => "0",
....
}
);
I was able to do it using a %HoH = (); and then just building the hash
as I went along, but is that "correct"?
------------------------------
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 V11 Issue 1648
***************************************