|
|
Up |
|
|
  |
Author: tadmctadmc
Date: May 26, 2008 23:11
Outline
Before posting to comp.lang.perl.misc
Must
- Check the Perl Frequently Asked Questions (FAQ)
- Check the other standard Perl docs (*.pod)
Really Really Should
- Lurk for a while before posting
- Search a Usenet archive
If You Like
- Check Other Resources
Posting to comp.lang.perl.misc
Is there a better place to ask your question?
- Question should be about Perl, not about the application area
How to participate (post) in the clpmisc community
- Carefully choose the contents of your Subject header
- Use an effective followup style
- Speak Perl rather than English, when possible
- Ask perl to help you
- Do not re-type Perl code
- Provide enough information ...
|
| Show full article (16.63Kb) |
|
| |
no comments
|
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: May 26, 2008 18:03
This is an excerpt from the latest version perlfaq4.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 .
--------------------------------------------------------------------
4.65: How can I store a multidimensional array in a DBM file?
Either stringify the structure yourself (no fun), or else get the MLDBM
(which uses Data::Dumper) module from CPAN and layer it on top of either
DB_File or GDBM_File.
--------------------------------------------------------------------
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.
|
| Show full article (1.21Kb) |
|
| |
2 Comments |
|
  |
Author: KDawg44KDawg44
Date: May 26, 2008 17:31
I am writing a top-down parser in Perl for a simple grammar. I would
like to split on a change in a character set. Is there a way to split
the tokens based on a change of a character set (like changing from a /
\w+/ to /+/ or something like that.
Basically I want to be able to split var = var1 + var 2; into tokens
(var, =, var1, +, var2, ;). I could do this with split / / but I
would also like var=var1+var2; to split into the same tokens.
How can I parse these two and get the same thing?
Thanks.
Kevin
|
| |
|
4 Comments |
|
  |
Author: Tim SmithTim Smith
Date: May 26, 2008 14:25
When I download the IPC::Shareable tarball and expand it, then "perl
Makefile.PL", "make", and "make test", the results are...odd.
On my Ubuntu 8.04 system (Athlon 64, but I have the 32-bit version of
Ubuntu installed), it passes all tests. I have done "make test" about
40 times, and every time, it passes all the tests.
On my Ubuntu 6.06 system (P4), it hangs on test t/38ipchv.
Same on one of my SUSE 10.1 systems and one of my SuSE 10.3 systems
(both using P4).
On my iMac (Intel Core Duo), it usually passes, but sometimes hangs on
test t/35clean, and sometimes fails test t/38ipchv, complaining of an
interrupted system call at line 32 (and then other complaints probably
stemming from that first failure).
On my PowerBook (PPC G4), it almost always has the failure in t/38ipchv,
and usually also fails t/35clean, with an error from
IPC::Sareable::SharedMem saying "shmget: No such file or directory". In
50 tries, I only saw one where it didn't have one or both of the above
failures (that one had t/30lock fail...I've never seen the PowerBook
pass).
Finally, my PowerMac (PPC G5) gets results similar to the PowerBook.
|
| Show full article (1.99Kb) |
|
3 Comments |
|
  |
Author: J.D. BaldwinJ.D. Baldwin
Date: May 26, 2008 14:22
I have a couple of ideas about this, I think, but maybe someone has
solved the problem cleverly already.
Given a very big list of networks (they happen to be in first / last
IP format, but I can convert easily enough to subnet/mask form, even
if it's an approximation) ... I want to make a smaller list of
networks that subsumes all the nets in the big list. e.g.,
10.28.45.0 - 10.28.46.255
10.28.42.0 - 10.28.42.255
10.28.47.0 - 10.28.49.255
10.28.43.0 - 10.28.44.255
... would be "consolidated" down into 10.28.42.0 - 10.28.49.255.
Any ideas? Modules? Thoughts?
--
_+_ From the catapult of |If anyone disagrees with any statement I make, I
_|70|___:)=}- J.D. Baldwin |am quite prepared not only to retract it, but also
\ / baldwin@ panix.com|to deny under oath that I ever made it. -T. Lehrer
***~~~~-----------------------------------------------------------------------
|
| |
|
4 Comments |
|
  |
Author: Bill HBill H
Date: May 26, 2008 12:26
Many times I have seen posted on here to consult perldoc for
information, and there is a wealth of information in there.
But if I could offer a suggestion, if the perldocs are online list
that url also.
Personally I do not surf the internet or read newsgroups on my
development computers, I use a different machine in my living room for
that (the one I am on) and I do not have perl installed on it. So to
look at some suggested information in perldoc I have to either email
myself a copy of the text, or print it, and then look it up on the
development systems when I am in the office. If there was / is a
perldocs online this would be very educational when I see those post
about looking up certain information in the docs I could just jump to
that site and read more.
Just my 2 cents :)
Bill H
|
| |
|
19 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: May 26, 2008 12:03
This is an excerpt from the latest version perlfaq5.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 .
--------------------------------------------------------------------
5.12: How can I open a filehandle to a string?
, , ,
(contributed by Peter J. Holzer, hjp-usenet2@hjp.at)
Since Perl 5.8.0, you can pass a reference to a scalar instead of the
filename to create a file handle which you can used to read from or
write to a string:
open(my $fh, '>', \$string) or die "Could not open string for writing";
print $fh "foo\n";
print $fh "bar\n"; # $string now contains "foo\nbar\n"
open(my $fh, '<', \$string) or die "Could not open string for reading";
my $x = <$fh>; # $x now contains "foo\n"
With older versions of Perl, the "IO::String" module provides similar
functionality.
|
| Show full article (1.68Kb) |
|
12 Comments |
|
  |
Author: mathematischmathematisch
Date: May 26, 2008 06:25
Dear Sir/Madame,
I have a couple of questions regarding multi-tasking using perl in a
unix multi-CPU environment.
I have a unix system with 4 CPU's. If i can divide the solution of a
problem into 4 independent subproblems, would there be a way then to
run 4 perl programs, each assigned one of the 4 problems for
processing? Each should use one of the four CPU's on the same machine
and somehow report to a main program upon finishing, so that the
partial results can be "merged".
As you see, it is more of a parallel programming question using perl.
Is the answer related to "forking child processes" ? Is forking child
processes and giving each child a chunk would be the best solution? Or
am I wrong? I am not very familiar with the unix and perl.
Do you have any information about a good tutorial about multi-tasking
with perl?
Thanks a lot for your response.
M.
|
| |
|
2 Comments |
|
  |
Author: PerlFAQ ServerPerlFAQ Server
Date: May 26, 2008 06:03
This is an excerpt from the latest version perlfaq4.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 .
--------------------------------------------------------------------
4.61: What's the difference between "delete" and "undef" with hashes?
Hashes contain pairs of scalars: the first is the key, the second is the
value. The key will be coerced to a string, although the value can be
any kind of scalar: string, number, or reference. If a key $key is
present in %%hash, "exists($hash{$key})" will return true. The value for
a given key can be "undef", in which case $hash{$key} will be "undef"
while "exists $hash{$key}" will return true. This corresponds to ($key,
"undef") being in the hash.
Pictures help... here's the %%hash table:
|
| Show full article (3.56Kb) |
|
2 Comments |
|
  |
|
|
  |
Author: KeenlearnerKeenlearner
Date: May 26, 2008 02:57
Hello, I have perl interpreter install using sypnatic package manager,
now I want to reinstall perl from the source code with different
configuration setting. Should I remove the perl first from the
sypnatic package ? when I try to to so they are a lot of package that
depend on perl, it seems unwise. So I just resinstall from source
directly,
./Configure -doptimize='-g'
make
Making x2p stuff
make[1]: Entering directory `/ home/william/p/perl-5.8.8/x2p'
You haven't done a "make depend" yet!
make[1]: *** [hash.o] Error 1
make[1]: Leaving directory `/ home/william/p/perl-5.8.8/x2p'
make: *** [translators] Error 2
When I run
make depend
|
| Show full article (0.99Kb) |
|
16 Comments |
|
|
|
|
|
|