|
Accessing a hash whose name is constructed I want to access some data from a hash, but want to build that hash's name on the fly... here's the code: %hello = (a => 'doggy'); print ${'hell' . lc 'O'}{a}; does the trick as does: print %{'hell' . lc 'O'}->{a}; however, under "use strict", this fails, since %hello isn't declared with "my". If I do p... 15 Apr 2008 21:53
How to know if data is piped into my script I have the following script: ----- #!/usr/bin/perl use strict; use warnings; my %hist = (); my @hist; $hist{(split /\s+/)[3]}++ foreach (`$ENV{'SHELL'} -c history`); print map {"$hist{$_} : $_\n"} sort {$hist{$b} <=> $hist{$a}} keys %hist; ----- I want to change it such that... 16 Apr 2008 02:39
FAQ 9.15 How do I parse a mail header? This is an excerpt from the latest version perlfaq9.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 at http://faq.perl.org . --------... 15 Apr 2008 15:39
Print a separator between each iteration of a foreach loop I want to print a separator between each iteration of a foreach loop, but not after the last element. How do I avoid printing the last extraneous comma in the following code snippet? foreach (@ARGV) { print $_, ','; } print "\n"; In this simple example join ',' would suffice, but the real body of the forea... 17 Apr 2008 08:33
PERL to mean what 'perldoc perl' says is wrong? >>>>> "GE" == Gordon Etly <get(a)bentsys.com> writes: GE> Yes, we all know that, and that is not the point I have tried GE> to make. GE> What is so wrong with adding to that list, GE> "PERL" refers to "Practical Extraction and Report Language" GE> ? It does not reflect the usage patter... 16 Apr 2008 18:04
Can "perldoc" take input from a pipe? Dear All, Is there a way to make perldoc take its input from stdin? I tried the obvious: command | perldoc but it didn't work. My idea is to embed "pod" documentation in source code written in Fortran and C++, then write a perl script that will search for the pod documentation, remove the comment marks, ... 15 Apr 2008 17:55
moving unused of a website Thank you Sinan and Peter for you prompt answers! Meanwhile I made some progress myself. I am reading in the file name of the unused pix, and then a grep starting with my "pix" folder, and then splitting over '/'. The result is three array elements, and the file name. I am testing, whether the two folde... 20 Apr 2008 05:00
PERL to mean what 'perldoc perl' says is wrong? (was: Re: perlshould be improved and perl6) Gordon Etly schrieb: Jim Cochrane wrote: (I better stop replying now before we get too far sidetracked from perl vs. Perl vs. PERL vs. pERL .......) Just for the record, that was never my plight. But alas it is no use, I see, given of all the closed-mindedness abound; what ever happened to ... 15 Apr 2008 23:29
FAQ 9.9 How do I automate an HTML form submission? This is an excerpt from the latest version perlfaq9.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 at http://faq.perl.org . --------... 15 Apr 2008 09:07
Creating PDF documents from a Perl Program... Hi there, I'm working on a database driven website and I need to output data in PDF format. The database handling is all written in Perl so I'd prefer to stick to Perl if possible, hence my question in this newsgroup! I've done some research and come up with a couple of ideas: PDF on the Fly from Nottingham Un... 21 Apr 2008 13:19 |