[28049] in Perl-Users-Digest
Perl-Users Digest, Issue: 9413 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 1 09:06:05 2006
Date: Sat, 1 Jul 2006 06:05:03 -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 Sat, 1 Jul 2006 Volume: 10 Number: 9413
Today's topics:
Re: Cam::PDF question <LtCommander@gmail.com>
Computer Industry Workers May Face Cancer Risks studyandjobs@yahoo.com
Does recursive call able to print in same page as main <ynleder@nspark.org>
Re: Does recursive call able to print in same page as m <David.Squire@no.spam.from.here.au>
Extract gzip Files <mikeflan@earthlink.net>
Re: languages with full unicode support <jo@durchholz.org>
Re: languages with full unicode support <rvtol+news@isolution.nl>
new CPAN modules on Sat Jul 1 2006 (Randal Schwartz)
Re: Rookie Perl Question <ermeyers@adelphia.net>
Re: Rookie Perl Question <john@castleamber.com>
Re: Rookie Perl Question <ermeyers@adelphia.net>
Re: Rookie Perl Question <rvtol+news@isolution.nl>
Re: test value <shane@weasel.is-a-geek.net>
Re: test value <shane@weasel.is-a-geek.net>
Re: test value <christoph.lamprecht.no.spam@web.de>
Re: What is Expressiveness in a Computer Language <jo@durchholz.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jun 2006 22:38:50 -0700
From: "LtCommander" <LtCommander@gmail.com>
Subject: Re: Cam::PDF question
Message-Id: <1151732330.762897.13010@p79g2000cwp.googlegroups.com>
Actually, I was pretty disappointed with PDF::API2 because it doesn't
even opent that PDF file! At least, CAM PDF returns nothing in the
pages with graphics. It opens other files though, but has trouble
opening the ones with graphics!
Brian Wakem wrote:
> Greger wrote:
>
> > LtCommander wrote:
> >
> >> Hi all,
> >>
> >> I am using the CAM::PDF module to extract text from PDF files. (It's an
> >> AMAZING module!!) You can pretty much do everything with it.
> >>
> >> My snippet for extracting text from a PDF file is:
> >>
> >> $pdf = CAM::PDF->new($Fil);
> >> $page = $pdf->getPageText($Pg);
> >>
> >> This works fine for all pages without any graphics. I am able to print
> >> the contents of $page without any problems whatsoever. However, if a
> >> particular page has some sort of an inline graphic, the $page returns
> >> an empty value!
> >>
> >> I was wondering:
> >> - If somebody knows how to remove all the graphics from the $pdf object
> >> before running the next line of code. I think that should fix it and no
> >> longer return any empty string.
> >>
> >> I've tried searching plenty but no luck so far!
> >>
> >> Would be grateful for your help.
> >>
> >> Vince
> > use PDF::API, available from cpan.
> >
> > (I also tried CAM::PDF some while ago but pdf::api is better.)
>
>
> I've always shelled out to pdftotext, I'll have a look at PDF::API too.
>
>
> --
> Brian Wakem
> Email: http://homepage.ntlworld.com/b.wakem/myemail.png
------------------------------
Date: 1 Jul 2006 02:38:09 -0700
From: studyandjobs@yahoo.com
Subject: Computer Industry Workers May Face Cancer Risks
Message-Id: <1151746689.046852.179890@m79g2000cwm.googlegroups.com>
Computer Industry Workers May Face Cancer Risks
http://www.studyandjobs.com/Comp_worker_cancer.html
or visit
http://www.studyandjobs.com/Cancer.html
Regards
------------------------------
Date: Sat, 1 Jul 2006 13:32:20 +0200
From: Yohan N. Leder <ynleder@nspark.org>
Subject: Does recursive call able to print in same page as main call
Message-Id: <MPG.1f107baba3a4f4979898b1@news.tiscali.fr>
I'm trying to do a differenciated recursive call (using command line
argument) print to same STDOUT than the one used during main first call.
#!/usr/bin/perl -w
use strict;
print "Content-type: text/html\n\n";
if ($#ARGV >= 0){print "<p>recursive call with cmdline argument</p>";}
else{print "<p>main call</p>";}
exit 0;
or
#!/usr/bin/perl -w
use strict;
if ($#ARGV >= 0){print "<p>recursive call with cmdline argument</p>";}
else{print "Content-type: text/html\n\n<p>main call</p>";}
exit 0;
Both show "main call" in browser, but nothing about "recursive call with
cmdline argument".
How to do ?
------------------------------
Date: Sat, 01 Jul 2006 12:54:44 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: Does recursive call able to print in same page as main call
Message-Id: <e85nq4$jf0$1@news.ox.ac.uk>
Yohan N. Leder wrote:
> I'm trying to do a differenciated recursive call (using command line
> argument) print to same STDOUT than the one used during main first call.
>
> #!/usr/bin/perl -w
> use strict;
> print "Content-type: text/html\n\n";
> if ($#ARGV >= 0){print "<p>recursive call with cmdline argument</p>";}
> else{print "<p>main call</p>";}
> exit 0;
>
> or
>
> #!/usr/bin/perl -w
> use strict;
> if ($#ARGV >= 0){print "<p>recursive call with cmdline argument</p>";}
> else{print "Content-type: text/html\n\n<p>main call</p>";}
> exit 0;
>
> Both show "main call" in browser, but nothing about "recursive call with
> cmdline argument".
I'm not at all sure what you are trying to do here, but it looks as if
you mean that you want your CGI script to call itself, while printing
its output to the browser. How are you doing the recursive call? Via a
call to system? How are you capturing and printing the output? Where are
the command line arguments getting set?
These scripts to not provide enough information to work out what you are
trying to do. There is no recursive call to a subroutine (the more
common sense of "recursive call"), nor is there any CGI redirect or
system call.
DS
------------------------------
Date: Sat, 01 Jul 2006 12:56:32 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Extract gzip Files
Message-Id: <44A671D3.55143E99@earthlink.net>
I want to extract all the gzip files in a directory to the same
directory. I know how to do this with zip files with
Archive::Zip and File::Find, but have not been able to do
it with gzip files. I have searched hard, but not found a
good solution yet, unless the best solution is Tie::Gzip
along with the gzip program.
I'd like to do this with Perl only if that is practical. I am
on Win2000 and don't have gzip (I don't think). I do
have WinZip and it will extract the files one-by-one.
I just downloaded Power Archiver 6.1, but would
prefer not to install it. My skill level is moderately
advanced - well maybe not, but far above newbie
anyway.
Mike Flannigan
------------------------------
Date: Sat, 01 Jul 2006 09:46:50 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: languages with full unicode support
Message-Id: <e8598q$et4$1@online.de>
Chris Uppal schrieb:
> Joachim Durchholz wrote:
>
>>> This is implementation-defined in C. A compiler is allowed to accept
>>> variable names with alphabetic Unicode characters outside of ASCII.
>> Hmm... that could would be nonportable, so C support for Unicode is
>> half-baked at best.
>
> Since the interpretation of characters which are yet to be added to
> Unicode is undefined (will they be digits, "letters", operators, symbol,
> punctuation.... ?), there doesn't seem to be any sane way that a language could
> allow an unrestricted choice of Unicode in identifiers.
I don't think this is a problem in practice. E.g. if a language uses the
usual definition for identifiers (first letter, then letters/digits),
you end up with a language that changes its definition on the whims of
the Unicode consortium, but that's less of a problem than one might
think at first.
I'd expect two kinds of changes in character categorization: additions
and corrections. (Any other?)
Additions are relatively unproblematic. Existing code will remain valid
and retain its semantics. The new characters will be available for new
programs.
There's a slight technological complication: the compiler needs to be
able to look up the newest definition. In other words, for a compiler to
run, it needs to be able to access http://unicode.org, or the language
infrastructure needs a way to carry around various revisions of the
Unicode tables and select the newest one.
Corrections are technically more problematic, but then we can rely on
the common sense of the programmers. If the Unicode consortium
miscategorized a character as a letter, the programmers that use that
character set will probably know it well enough to avoid its use. It
will probably not even occur to them that that character could be a
letter ;-)
Actually I'm not sure that Unicode is important for long-lived code.
Code tends to not survive very long unless it's written in English, in
which case anything outside of strings is in 7-bit ASCII. So the
majority of code won't ever be affected by Unicode problems - Unicode is
more a way of lowering entry barriers.
Regards,
Jo
------------------------------
Date: Sat, 1 Jul 2006 12:51:27 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: languages with full unicode support
Message-Id: <e85r9h.11k.1@news.isolution.nl>
Chris Uppal schreef:
> Since the interpretation of characters which are yet to be added to
> Unicode is undefined (will they be digits, "letters", operators,
> symbol, punctuation.... ?), there doesn't seem to be any sane way
> that a language could allow an unrestricted choice of Unicode in
> identifiers.
The Perl-code below prints:
xdigit
22 /194522 = 0.011% (lower: 6, upper: 6)
ascii
128 /194522 = 0.066% (lower: 26, upper: 26)
\d
268 /194522 = 0.138%
digit
268 /194522 = 0.138%
IsNumber
612 /194522 = 0.315%
alpha
91183 /194522 = 46.875% (lower: 1380, upper: 1160)
alnum
91451 /194522 = 47.013% (lower: 1380, upper: 1160)
word
91801 /194522 = 47.193% (lower: 1380, upper: 1160)
graph
102330 /194522 = 52.606% (lower: 1380, upper: 1160)
print
102349 /194522 = 52.616% (lower: 1380, upper: 1160)
blank
18 /194522 = 0.009%
space
24 /194522 = 0.012%
punct
374 /194522 = 0.192%
cntrl
6473 /194522 = 3.328%
Especially look at 'word', the same as \w, which for ASCII is
[0-9A-Za-z_].
==8<===================
#!/usr/bin/perl
# Program-Id: unicount.pl
# Subject: show Unicode statistics
use strict ;
use warnings ;
use Data::Alias ;
binmode STDOUT, ':utf8' ;
my @table =
# +--Name------+---qRegexp--------+-C-+-L-+-U-+
(
[ 'xdigit' , qr/[[:xdigit:]]/ , 0 , 0 , 0 ] ,
[ 'ascii' , qr/[[:ascii:]]/ , 0 , 0 , 0 ] ,
[ '\\d' , qr/\d/ , 0 , 0 , 0 ] ,
[ 'digit' , qr/[[:digit:]]/ , 0 , 0 , 0 ] ,
[ 'IsNumber' , qr/\p{IsNumber}/ , 0 , 0 , 0 ] ,
[ 'alpha' , qr/[[:alpha:]]/ , 0 , 0 , 0 ] ,
[ 'alnum' , qr/[[:alnum:]]/ , 0 , 0 , 0 ] ,
[ 'word' , qr/[[:word:]]/ , 0 , 0 , 0 ] ,
[ 'graph' , qr/[[:graph:]]/ , 0 , 0 , 0 ] ,
[ 'print' , qr/[[:print:]]/ , 0 , 0 , 0 ] ,
[ 'blank' , qr/[[:blank:]]/ , 0 , 0 , 0 ] ,
[ 'space' , qr/[[:space:]]/ , 0 , 0 , 0 ] ,
[ 'punct' , qr/[[:punct:]]/ , 0 , 0 , 0 ] ,
[ 'cntrl' , qr/[[:cntrl:]]/ , 0 , 0 , 0 ] ,
) ;
my @codepoints =
(
0x0000 .. 0xD7FF,
0xE000 .. 0xFDCF,
0xFDF0 .. 0xFFFD,
0x10000 .. 0x1FFFD,
0x20000 .. 0x2FFFD,
# 0x30000 .. 0x3FFFD, # etc.
) ;
for my $row ( @table )
{
alias my ($name, $qrx, $count, $lower, $upper) = @$row ;
printf "\n%s\n", $name ;
my $n = 0 ;
for ( @codepoints )
{
local $_ = chr ; # int-2-char conversion
$n++ ;
if ( /$qrx/ )
{
$count++ ;
$lower++ if / [[:lower:]] /x ;
$upper++ if / [[:upper:]] /x ;
}
}
my $show_lower_upper =
($lower || $upper)
? sprintf( " (lower:%6d, upper:%6d)"
, $lower
, $upper
)
: '' ;
printf "%6d /%6d =%7.3f%%%s\n"
, $count
, $n
, 100 * $count / $n
, $show_lower_upper
}
__END__
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 1 Jul 2006 04:42:07 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Sat Jul 1 2006
Message-Id: <J1pJq7.1JJM@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Algorithm-RabinKarp-0.39
http://search.cpan.org/~nnunley/Algorithm-RabinKarp-0.39/
Rabin-Karp streaming hash
----
Apache-Upload-Slurp-0.02
http://search.cpan.org/~ebruni/Apache-Upload-Slurp-0.02/
Component to slurp all uploaded file
----
App-CLI-0.06
http://search.cpan.org/~clkao/App-CLI-0.06/
Dispatcher module for command line interface programs
----
Calendar-Schedule-0.04
http://search.cpan.org/~vlado/Calendar-Schedule-0.04/
for managing calendar schedules
----
Class-Pluggable-0.022
http://search.cpan.org/~takeshige/Class-Pluggable-0.022/
Simple pluggable class.
----
DBIx-Web-0.62
http://search.cpan.org/~makarow/DBIx-Web-0.62/
Active Web Database Layer
----
Math-ConvexHull-1.01
http://search.cpan.org/~smueller/Math-ConvexHull-1.01/
Calculate convex hulls using Graham's scan (n*log(n))
----
Math-Random-0.68
http://search.cpan.org/~grommel/Math-Random-0.68/
Random Number Generators
----
Math-SparseMatrix-0.01
http://search.cpan.org/~jmahesh/Math-SparseMatrix-0.01/
A Perl module for basic sparse matrix operations such as creation, reading from file, reading transpose from file and writing to file.
----
Math-SparseVector-0.01
http://search.cpan.org/~jmahesh/Math-SparseVector-0.01/
Implements Sparse Vector Operations. The code is entirely borrowed from the existing Sparse::Vector v0.03 module on CPAN, and re-cast into a new namespace in order to introduce another module Math::Sp
----
Math-SparseVector-0.03
http://search.cpan.org/~jmahesh/Math-SparseVector-0.03/
Implements Sparse Vector Operations. The code is entirely borrowed from the existing Sparse::Vector v0.03 module on CPAN, and re-cast into a new namespace in order to introduce another module Math::Sp
----
Module-ScanDeps-0.61
http://search.cpan.org/~smueller/Module-ScanDeps-0.61/
Recursively scan Perl code for dependencies
----
Net-RTP-0.03
http://search.cpan.org/~njh/Net-RTP-0.03/
Send and recieve RTP packets (RFC3550)
----
Net-SynchroEdit-Service-0.039
http://search.cpan.org/~kallewoof/Net-SynchroEdit-Service-0.039/
Perl extension for SynchroEdit response service functionality
----
P5NCI-0.30
http://search.cpan.org/~chromatic/P5NCI-0.30/
Perl extension for loading shared libraries and their functions
----
RPC-XML-0.59
http://search.cpan.org/~rjray/RPC-XML-0.59/
A set of classes for core data, message and XML handling
----
Rose-DB-0.72
http://search.cpan.org/~jsiracusa/Rose-DB-0.72/
A DBI wrapper and abstraction layer.
----
Rose-DB-Object-0.74
http://search.cpan.org/~jsiracusa/Rose-DB-Object-0.74/
Extensible, high performance RDBMS-OO mapper.
----
SVK-1.08
http://search.cpan.org/~clkao/SVK-1.08/
A Distributed Version Control System
----
SVN-Notify-2.62
http://search.cpan.org/~dwheeler/SVN-Notify-2.62/
Subversion activity notification
----
Sub-Assert-1.21
http://search.cpan.org/~smueller/Sub-Assert-1.21/
Design-by-contract like pre- and postconditions, etc.
----
Sys-Manage-0.54
http://search.cpan.org/~makarow/Sys-Manage-0.54/
Systems management commands/scripts environment
----
Test-Harness-2.63_01
http://search.cpan.org/~petdance/Test-Harness-2.63_01/
Run Perl standard test scripts with statistics
----
Test-Harness-2.63_02
http://search.cpan.org/~petdance/Test-Harness-2.63_02/
Run Perl standard test scripts with statistics
----
Tie-Tk-Listbox-1.02
http://search.cpan.org/~smueller/Tie-Tk-Listbox-1.02/
Access Tk::Listbox and similar widgets as arrays
----
Time-Clock-0.10
http://search.cpan.org/~jsiracusa/Time-Clock-0.10/
Twenty-four hour clock objects with nanosecond precision.
----
Tkx-1.04
http://search.cpan.org/~gaas/Tkx-1.04/
Yet another Tk interface
----
WWW-Mediawiki-Client-0.30
http://search.cpan.org/~markj/WWW-Mediawiki-Client-0.30/
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Fri, 30 Jun 2006 21:48:30 -0400
From: "Eric R. Meyers" <ermeyers@adelphia.net>
Subject: Re: Rookie Perl Question
Message-Id: <SqWdnUuPwuXtSTjZnZ2dnUVZ_oqdnZ2d@adelphia.com>
Tad McClellan wrote:
> Eric R. Meyers <ermeyers@adelphia.net> wrote:
>
>> print if ( ! m/^[#]/ );
>
>
> That is fine if you are trying to hide what the code does.
>
> In case you might prefer maintainable code instead, then:
>
> print unless /^#/;
>
>
That's a style issue, not a function issue. I personally never use
'unless,' unless I've got a really good reason to 'unless.'
'if' and 'while' for a beginner.
------------------------------
Date: 1 Jul 2006 03:24:04 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Rookie Perl Question
Message-Id: <Xns97F2E3DEC78E2castleamber@130.133.1.4>
"Eric R. Meyers" <ermeyers@adelphia.net> wrote:
> Tad McClellan wrote:
>
>> Eric R. Meyers <ermeyers@adelphia.net> wrote:
>>
>>> print if ( ! m/^[#]/ );
>>
>>
>> That is fine if you are trying to hide what the code does.
>>
>> In case you might prefer maintainable code instead, then:
>>
>> print unless /^#/;
>>
>>
> That's a style issue, not a function issue. I personally never use
> 'unless,' unless I've got a really good reason to 'unless.'
>
> 'if' and 'while' for a beginner.
Nonsense. I strongly recommend to use unless if the if ! construct looks
like a lot of noise as in "if ( ! m/^[#]/ );", especially since it has a
lot of noise overhead ([] not needed, m not needed, () not needed).
--
John Bokma Freelance software developer
&
Experienced Perl programmer: http://castleamber.com/
------------------------------
Date: Fri, 30 Jun 2006 23:51:20 -0400
From: "Eric R. Meyers" <ermeyers@adelphia.net>
Subject: Re: Rookie Perl Question
Message-Id: <nvCdnd6S17-kbDjZnZ2dnUVZ_sadnZ2d@adelphia.com>
John Bokma wrote:
> "Eric R. Meyers" <ermeyers@adelphia.net> wrote:
>
>> Tad McClellan wrote:
>>
>>> Eric R. Meyers <ermeyers@adelphia.net> wrote:
>>>
>>>> print if ( ! m/^[#]/ );
>>>
>>>
>>> That is fine if you are trying to hide what the code does.
>>>
>>> In case you might prefer maintainable code instead, then:
>>>
>>> print unless /^#/;
>>>
>>>
>> That's a style issue, not a function issue. I personally never use
>> 'unless,' unless I've got a really good reason to 'unless.'
>>
>> 'if' and 'while' for a beginner.
>
> Nonsense. I strongly recommend to use unless if the if ! construct looks
> like a lot of noise as in "if ( ! m/^[#]/ );", especially since it has a
> lot of noise overhead ([] not needed, m not needed, () not needed).
>
Hi John! Again, it's a style issue, not a function issue. I like the
noise, because I have an affinity for the apparently meaningless syntax of
Perl. I can read it. We all have very different personal styles and
patterns, as well as very different personal opinions. Right John.
Everything and everyone coexists in this world, and Perl supports both your
way and my way. That's the beauty of Perl, which I'll always advocate.
This beginner understands awk, sed and grep, but he may not know that Perl
can do anything an everything that we can think of doing, because we just
have to create a module to do what we want, if it isn't already there for
us to use for the public good.
------------------------------
Date: Sat, 1 Jul 2006 12:56:58 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Rookie Perl Question
Message-Id: <e85riv.1ck.1@news.isolution.nl>
Tad McClellan schreef:
> Eric R. Meyers:
>> print if ( ! m/^[#]/ );
>
> That is fine if you are trying to hide what the code does.
>
> In case you might prefer maintainable code instead, then:
>
> print unless /^#/;
And if you want to put the focus on skipping comment lines:
/^#/ or print ;
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 01 Jul 2006 17:31:36 +1200
From: Shane <shane@weasel.is-a-geek.net>
Subject: Re: test value
Message-Id: <e851an$tjp$1@lust.ihug.co.nz>
John Bokma wrote:
> Josef Moellers <josef.moellers@fujitsu-siemens.com> wrote:
>
>> John Bokma wrote:
>>> Shane <shane@weasel.is-a-geek.net> wrote:
>>>
>>>
>>>>I have some nasty code, that I want to check the value of something
>>>>held in a scalar, but there is 'no' value held in there
>>>>
>>>>Data::Dumper tells me the $val = []
>>>
>>>
>>> $val contains a reference to an empty array, like:
>>>
>>> my @array = ();
>>> my $val = \@array;
>>
>> if (@$val == 0) {
>> print "Empty\n";
>> }
>
> @$val or print "Empty\n";
>
Apologies for the delay between your answer and my reading the post
To make matters slightly more complicated $val is an arrayref, in a hash
If I use the following if @($hash->{$val}) I get
Scalar found where operator expected at ./attempt3.pl line 254,
near "@($hash"
(Missing operator before $hash?)
Scalar found where operator expected at ./attempt3.pl line 255, near "$val"
(Missing semicolon on previous line?)
syntax error at ./attempt3.pl line 254, near "@($hash"
syntax error at ./attempt3.pl line 260, near "}"
Execution of ./attempt3.pl aborted due to compilation errors.
--
Rule 6: There is no rule 6
Blog: http://shanes.dyndns.org
------------------------------
Date: Sat, 01 Jul 2006 17:35:55 +1200
From: Shane <shane@weasel.is-a-geek.net>
Subject: Re: test value
Message-Id: <e851iq$tjp$2@lust.ihug.co.nz>
Nick of course wrote:
>
> Shane wrote:
>> I have some nasty code, that I want to check the value of something held
>> in a scalar, but there is 'no' value held in there
>>
>> Data::Dumper tells me the $val = []
>>
>> How do I test for that?
>>
>> --
>> Rule 6: There is no rule 6
>>
>> Blog: http://shanes.dyndns.org
>
> if (ref $val eq 'ARRAY' && @$val == 0) { ... }
Unfortunately this expression captures other references that have a value in
the array they point to
--
Rule 6: There is no rule 6
Blog: http://shanes.dyndns.org
------------------------------
Date: Sat, 01 Jul 2006 12:38:49 +0200
From: Ch Lamprecht <christoph.lamprecht.no.spam@web.de>
Subject: Re: test value
Message-Id: <e85jbm$2p0$1@online.de>
Shane wrote:
> To make matters slightly more complicated $val is an arrayref, in a hash
> If I use the following if @($hash->{$val}) I get
> Scalar found where operator expected at ./attempt3.pl line 254,
One way of dereferencing arrayrefs is:
@{$arrayref}
However, you are using $val as a hash key here...
You didn't tell anything about the value of $hash->{$val}.
It would be much easier to help you, if you posted a short but complete example.
Documentation on perl references and data structures:
perldoc perlreftut
perldoc perldsc
perldoc perllol
Christoph
--
perl -e "print scalar reverse q/ed.enilno@ergn.l.hc/"
------------------------------
Date: Sat, 01 Jul 2006 09:28:22 +0200
From: Joachim Durchholz <jo@durchholz.org>
Subject: Re: What is Expressiveness in a Computer Language
Message-Id: <e85866$clu$1@online.de>
Matthias Blume schrieb:
> Erlang relies on a combination of purity, concurrency, and message
> passing, where messages can carry higher-order values.
>
> Data structures are immutable, and each computational agent is a
> thread. Most threads consist a loop that explicitly passes state
> around. It dispatches on some input event, applies a state
> transformer (which is a pure function), produces some output event (if
> necessary), and goes back to the beginning of the loop (by
> tail-calling itself) with the new state.
Actually any Erlang process, when seen from the outside, is impure: it
has observable state.
However, from what I hear, such state is kept to a minimum. I.e. the
state involved is just the state that's mandated by the purpose of the
process, not by computational bookkeeping - you won't send file
descriptors in a message, but maybe information about the state of some
hardware, or about a permanent log.
So to me, the approach of Erlang seems to amount to "make pure
programming so easy and efficient that aren't tempted to introduce state
that isn't already there".
Regards,
Jo
------------------------------
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 V10 Issue 9413
***************************************