comp.lang.perl.misc
  Home FAQ Contact Sign in
comp.lang.perl.misc only
 
Advanced search
March 2008
motuwethfrsasuw
     12 9
3456789 10
10111213141516 11
17181920212223 12
24252627282930 13
31       14
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.perl.misc Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Why is "$A::a" and "$a" diffrent ?         


Author: jh3an
Date: Mar 13, 2008 21:38

The following code doesn't make any sense, does it ?
{
package A;
my $a = 3;
if( ! ($a == $A::a) ){print "not equal\n"}
}

#output will be:
not equal

Why ? I think $A::a equals $a.
If I do not use "my" operator, output will be the one as I expect.

Does "my" operator do something in this case?

Without my operator>>
{
package A;
$a = 3;
if(!($a == $A::a)){print "not equal\n"}
else{ print "equal\n";}
}
Show full article (0.44Kb)
3 Comments
  FAQ 5.31 How can I tell whether there's a character waiting on a filehandle?         


Author: PerlFAQ Server
Date: Mar 13, 2008 18: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.31: How can I tell whether there's a character waiting on a filehandle?

The very first thing you should do is look into getting the
Term::ReadKey extension from CPAN. As we mentioned earlier, it now even
has limited support for non-portable (read: not open systems, closed,
proprietary, not POSIX, not Unix, etc) systems.

You should also check out the Frequently Asked Questions list in
comp.unix.* for things like this: the answer is essentially the same.
It's very system dependent. Here's one solution that works on BSD
systems:
Show full article (3.21Kb)
no comments
  m// on very long lines leaks memory         


Author: ShaunJ
Date: Mar 13, 2008 14:26

The following snippet leaks memory until it breaks and falls down when
m// is used on a very long line. It works fine if the line lengths are
short. Try
./test.pl /usr/share/dict/words /usr/share/dict/words
Depending on your dictionary, you'll see that compiling the regex
takes about 200 MB. However the following matching loop leaks memory
at an alarming rate. Start up `top` and watch it run. I'm using Perl
5.8.6 built for darwin-thread-multi-2level. If anyone cares to confirm
or deny this behaviour for other architectures or version of Perl,
that would be interesting too.

Cheers,
Shaun

#!/usr/bin/perl
use strict;
use English;
open REFILE, '<' . shift;
chomp (my @restrings = );
close REFILE;
my @re = map { qr/$_/ } @restrings;
Show full article (0.95Kb)
5 Comments
  USENIX Announces Open Access to Conference Proceedings         


Author: Lionel Garth Jones
Date: Mar 13, 2008 13:37

USENIX is pleased to announce open public access to all its conference
proceedings.

This significant decision will allow universal access to some of the
most important technical research in advanced computing. In making this
move USENIX is setting the standard for open access to information, an
essential part of its mission.

USENIX could not achieve such goals without the support and dedication
of its membership. We urge you to encourage others to join USENIX.
Membership helps us present over 20 influential conferences each year
and offer open access to the technical information presented there.

USENIX conference proceedings can be found at:
http://www.usenix.org/publications/library/proceedings/

Questions? Contact papersinfo@usenix.org.
no comments
  req example uncompressing mybigdir.tar.gz file         


Author: monk
Date: Mar 13, 2008 12:55

I'm looking for the equivalent of the command `tar xvzpf
mybigdir.tar.gz`

I'd like to use core modules to uncompress gunzipped and tarballs.

mybigdir.tar.gz. Inside the tarball, there are two subdirectories(foo
and lando). Each subdirectory has regular ascii files.

Do you mind providing an example which decompresses myfile.tar.gz
while keeping the dir structure? dumping it into that same root
directory or other directory.

Thanks in advance,
no comments
  comparing a 2D array         


Author: Rose
Date: Mar 13, 2008 12:53

For the following 2D array comparison codes modified from perllol google
search, I wonder why the output generated is not what I expected. Could
anybody tell me what i should modify in order to have an exact match of all
the attributes of a row from an individual file? Thanks a lot~

#!/usr/bin/perl

use warnings;

$usage='prog t1 t2 cmpname';
die "Usage: $usage\n" if $#ARGV < 1;

$outname = $ARGV[2];
$file1 = $ARGV[0];
$file2 = $ARGV[1];
$cmpcout = $outname . ".cmpofcmp.xls";

open(FP1, $file1);
open(FP2, $file2);
open(CMP, ">$cmpcout");
Show full article (1.45Kb)
11 Comments
  FAQ 5.35 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?         


Author: PerlFAQ Server
Date: Mar 13, 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.35: Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work?

Whoops! You just put a tab and a formfeed into that filename! Remember
that within double quoted strings ("like\this"), the backslash is an
escape character. The full list of these is in "Quote and Quote-like
Operators" in perlop. Unsurprisingly, you don't have a file called
"c:(tab)emp(formfeed)oo" or "c:(tab)emp(formfeed)oo.exe" on your legacy
DOS filesystem.

Either single-quote your strings, or (preferably) use forward slashes.
Since all DOS and Windows versions since something like MS-DOS 2.0 or so
have treated "/" and "\" the same in a path, you might as well use the
one that doesn't clash with Perl--or the POSIX shell, ANSI C and C++,
awk, Tcl, Java, or Python, just to mention a few. POSIX paths are more
portable, too.
Show full article (1.84Kb)
3 Comments
  command output         


Author: jammer
Date: Mar 13, 2008 11:01

There is no output from this:
`/usr/bin/ls -l "$backupDir/$backupName"`;

This shows correct values:
print "/usr/bin/ls -l $backupDir/$backupName";
9 Comments
  4th Italian Perl Workshop 2008 - Call for Papers /Participation         


Author: Enrico Sorcinelli
Date: Mar 13, 2008 10:22

Hi all,

the Italian Perl Mongers and the Pisa.pm group are proud to announce the Fourth
Italian Perl Workshop.

The Workshop is aimed at Perl users, professionals and hobbyists alike, but
also to those who are just starting out in this language and want to learn its
characteristics and culture.

The Workshop will be held in Pisa, in rooms kindly offered by the Computer
Science department of the University of Pisa, on September 18-19, 2008.

In addition to classic conference-style talks, there will be discussions and
debates on topics of interest, proposed by participants and guided by experts.
See:

http://conferences.yapceurope.org/ipw2008/cfp.html

for the complete "Call for Papers & Questions".

Registration and participation are free of charge, and includes a coffee-break
service, also gratis.
In addition, you could have (by paying the optional ticket conference):

- event T-Shirt
- perl.it gadgets
Show full article (1.61Kb)
no comments
  Style and subroutines in Perl Programs         


Author: pgodfrin
Date: Mar 13, 2008 10:19

Greetings,

I've browsed the Camel book and perldoc.perl.org about style in a
program and I was wondering what most people think.

I'm in the habit of the following pseudo-code structure of my programs
(or are they scripts :) ):

0. shebang and comments
1. Use statements
2. 'global' variables or constants
3. INIT or BEGINs
4. Subroutine definitions
5. main program, using a "MAIN:" label (just so I can find it)
6. an exit; statement
7. END code

I've seen some code where the subroutines are placed after the "main"
program - this way (my way) seems logical to me, but short of starting
a war of opinion, I was wondering what others thought about the
placement of subroutines?

regards,
phil g
8 Comments
1 2