[22980] in Perl-Users-Digest
Perl-Users Digest, Issue: 5200 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 9 21:22:51 2003
Date: Wed, 9 Jul 2003 18:20:55 -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 Wed, 9 Jul 2003 Volume: 10 Number: 5200
Today's topics:
How to retrieve a scalar name in a foreach loop (Eric Pement)
Re: How to retrieve a scalar name in a foreach loop (Greg Bacon)
Re: How to retrieve a scalar name in a foreach loop <noreply@gunnar.cc>
Re: How to retrieve a scalar name in a foreach loop <tassilo.parseval@rwth-aachen.de>
Re: How to retrieve a scalar name in a foreach loop <mjcarman@mchsi.com>
Re: How to retrieve a scalar name in a foreach loop <noreply@gunnar.cc>
Re: How to retrieve a scalar name in a foreach loop <abigail@abigail.nl>
Re: How to retrieve a scalar name in a foreach loop <tassilo.parseval@rwth-aachen.de>
Re: How to retrieve a scalar name in a foreach loop <bdonlan@bd-home-comp.no-ip.org>
Re: How to retrieve a scalar name in a foreach loop (Eric Pement)
html table tag indent script? <tech7890@yahoo.com>
Re: huge hash creates Illegal instruction (core dumped) (Hauke Juhls)
I need some help (Alexnotknowing)
Re: I need some help <abigail@abigail.nl>
Re: I need some help <g4rry_short@zw4llet.com>
Re: I need some help <simon.andrews@bbsrc.ac.uk>
info <cobra@localhost.localdomain>
Invoking Win32 dll from Perl. <sk@usa.net>
Re: Invoking Win32 dll from Perl. <cat@no-spam.com>
Re: Invoking Win32 dll from Perl. <sk@usa.net>
Re: Invoking Win32 dll from Perl. <cat@no-spam.com>
Re: Invoking Win32 dll from Perl. <sk@usa.net>
Is www.yetanother.org down? <irving_kimura@lycos.com>
Re: Is www.yetanother.org down? <jkeen@concentric.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Jul 2003 10:51:39 -0700
From: pemente@northpark.edu (Eric Pement)
Subject: How to retrieve a scalar name in a foreach loop
Message-Id: <227a55e9.0307080951.40511a4f@posting.google.com>
I have a question that's really bugging me. I've tried looking in the
Perl FAQ, the Perl Cookbook, the White Camel, and the Perl How-to
under words like scalars, variables, names, reference, and
dereference. No luck. (Or if the answer was present, I didn't
recognize it.)
What I'd like to do is something like this, where foreach() is
followed by a list of scalars:
$v1 = "foo";
$v2 = "bar";
$v3 = "baz";
foreach my $arg ($v1, $v2, $v3) {
print "name: \\$arg, value: $arg\n";
}
Desired output:
name: $v1, value: foo
name: $v2, value: bar
name: $v3, value: baz
Obviously, \\$arg won't work, and I've tried 15 other constructions
and ways of building the foreach loop, all without success. What's the
ticket here? How do I retrieve the name of the variable instead of its
value?
Now I expect that someone will suggest that I build a hash and then
run "foreach(sort keys %hash)" to retrieve name-value pairs. That's
not perfectly workable for me. What I'm actually doing is debugging
someone else's CGI script of several thousand uncommented lines, and
at key points I need to access the simple scalars that are already
present rather than rewriting everything. In point of fact, the
application calls over a dozen perl scripts and setting files, and I
don't have the time or the mandate to overhaul the entire script. What
I need are some well-placed diagnostics which will be used today and
erased tomorrow, and the answer to this question would really help.
Thanks in advance.
--
Eric Pement
------------------------------
Date: Tue, 08 Jul 2003 18:07:37 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <vgm239ictvor48@corp.supernews.com>
In article <227a55e9.0307080951.40511a4f@posting.google.com>,
Eric Pement <pemente@northpark.edu> wrote:
: $v1 = "foo";
: $v2 = "bar";
: $v3 = "baz";
: foreach my $arg ($v1, $v2, $v3) {
: print "name: \\$arg, value: $arg\n";
: }
:
: Desired output:
:
: name: $v1, value: foo
: name: $v2, value: bar
: name: $v3, value: baz
% cat try
#! /usr/local/bin/perl
$v1 = "foo";
$v2 = "bar";
$v3 = "baz";
foreach my $arg (qw/ v1 v2 v3 /) {
my $val = defined $$arg ? $$arg : "<undef>";
print "name: \$$arg, value: $val\n";
}
% ./try
name: $v1, value: foo
name: $v2, value: bar
name: $v3, value: baz
You should feel dirty after such naughtiness. Go take a shower. :-)
Hope this helps,
Greg
--
We believe--or we act as if we believed--that although an individual father
cannot alienate the labor of his son, the aggregate body of fathers may
alienate the labor of all their sons . . .
-- Thomas Jefferson
------------------------------
Date: Tue, 08 Jul 2003 20:30:29 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <bef2rm$4f99c$1@ID-184292.news.dfncis.de>
Greg Bacon wrote:
> In article <227a55e9.0307080951.40511a4f@posting.google.com>,
> Eric Pement <pemente@northpark.edu> wrote:
>
> : $v1 = "foo";
> : $v2 = "bar";
> : $v3 = "baz";
> : foreach my $arg ($v1, $v2, $v3) {
> : print "name: \\$arg, value: $arg\n";
> : }
> :
> : Desired output:
> :
> : name: $v1, value: foo
> : name: $v2, value: bar
> : name: $v3, value: baz
<snip>
> foreach my $arg (qw/ v1 v2 v3 /) {
> my $val = defined $$arg ? $$arg : "<undef>";
> print "name: \$$arg, value: $val\n";
> }
Or without symrefs:
foreach my $arg (qw/$v1 $v2 $v3/) {
print "name: $arg, value: ", eval $arg, "\n";
}
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 8 Jul 2003 19:09:47 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <bef4tr$gkd$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Gunnar Hjalmarsson:
> Greg Bacon wrote:
>> In article <227a55e9.0307080951.40511a4f@posting.google.com>,
>> Eric Pement <pemente@northpark.edu> wrote:
>>
>> : $v1 = "foo";
>> : $v2 = "bar";
>> : $v3 = "baz";
>> : foreach my $arg ($v1, $v2, $v3) {
>> : print "name: \\$arg, value: $arg\n";
>> : }
>> :
>> : Desired output:
>> :
>> : name: $v1, value: foo
>> : name: $v2, value: bar
>> : name: $v3, value: baz
>
><snip>
>
>> foreach my $arg (qw/ v1 v2 v3 /) {
>> my $val = defined $$arg ? $$arg : "<undef>";
>> print "name: \$$arg, value: $val\n";
>> }
>
> Or without symrefs:
>
> foreach my $arg (qw/$v1 $v2 $v3/) {
> print "name: $arg, value: ", eval $arg, "\n";
> }
Or with strict-proof symrefs:
use strict;
# those need to be package-qualified (or our()ed or 'use var'ed)
$::v1 = "foo";
$::v2 = "bar";
$::v3 = "baz";
foreach my $arg (qw/v1 v2 v3/) {
print "name: \$$arg, value: ${ $::{ $arg } }\n";
}
Not that strictures would matter here a lot, though.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 08 Jul 2003 13:50:44 -0500
From: Michael Carman <mjcarman@mchsi.com>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <bef3q5$in52@onews.collins.rockwell.com>
On 7/8/2003 12:51 PM, Eric Pement wrote:
>
> I'd like to do is something like this, where foreach() is
> followed by a list of scalars:
>
> $v1 = "foo";
> $v2 = "bar";
> $v3 = "baz";
> foreach my $arg ($v1, $v2, $v3) {
> print "name: \\$arg, value: $arg\n";
> }
>
> Desired output:
>
> name: $v1, value: foo
> name: $v2, value: bar
> name: $v3, value: baz
>
> How do I retrieve the name of the variable instead of its value?
Are the variables globals or lexicals? If they're lexicals, you
(typically) don't. The variable names aren't stored anyplace normally
accessible. That said, the PadWalker module may do what you want. I've
never used it, so I can't give you any pointers there. Check the docs
and search the newsgroup archives for examples.
If the variables are globals, you could walk the symbol table. Quick &
dirty example:
#!/rfs/apps/bin/perl5.6.1 -w
use strict;
use warnings;
our $v1 = 'foo';
our $v2 = 'bar';
our $v3 = 'baz';
foreach my $arg ($v1, $v2, $v3) {
for my $vn (keys %main::) {
no strict 'refs';
if (*{"*main::$vn"}{SCALAR} eq \$arg) {
print "name: \$$vn, value = '$arg'\n";
}
}
}
__END__
name: $v1, value = 'foo'
name: $v2, value = 'bar'
name: $v3, value = 'baz'
-mjc
------------------------------
Date: Tue, 08 Jul 2003 21:18:20 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <bef5lg$4f0a0$1@ID-184292.news.dfncis.de>
Tassilo v. Parseval wrote:
> Also sprach Gunnar Hjalmarsson:
>
>>Or without symrefs:
>>
>> foreach my $arg (qw/$v1 $v2 $v3/) {
>> print "name: $arg, value: ", eval $arg, "\n";
>> }
>
> Or with strict-proof symrefs:
>
> use strict;
>
> # those need to be package-qualified (or our()ed or 'use var'ed)
> $::v1 = "foo";
> $::v2 = "bar";
> $::v3 = "baz";
>
> foreach my $arg (qw/v1 v2 v3/) {
> print "name: \$$arg, value: ${ $::{ $arg } }\n";
> }
>
> Not that strictures would matter here a lot, though.
But if the variables OP is exploring include lexically scoped
variables, symrefs isn't such a good idea, right?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 08 Jul 2003 19:29:18 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <slrnbgm6sd.jme.abigail@alexandra.abigail.nl>
Tassilo v. Parseval (tassilo.parseval@rwth-aachen.de) wrote on MMMDXCVIII
September MCMXCIII in <URL:news:bef4tr$gkd$1@nets3.rz.RWTH-Aachen.DE>:
@@ Also sprach Gunnar Hjalmarsson:
@@
@@ > Greg Bacon wrote:
@@ >> In article <227a55e9.0307080951.40511a4f@posting.google.com>,
@@ >> Eric Pement <pemente@northpark.edu> wrote:
@@ >>
@@ >> : $v1 = "foo";
@@ >> : $v2 = "bar";
@@ >> : $v3 = "baz";
@@ >> : foreach my $arg ($v1, $v2, $v3) {
@@ >> : print "name: \\$arg, value: $arg\n";
@@ >> : }
@@ >> :
@@ >> : Desired output:
@@ >> :
@@ >> : name: $v1, value: foo
@@ >> : name: $v2, value: bar
@@ >> : name: $v3, value: baz
@@ >
@@ ><snip>
@@ >
@@ >> foreach my $arg (qw/ v1 v2 v3 /) {
@@ >> my $val = defined $$arg ? $$arg : "<undef>";
@@ >> print "name: \$$arg, value: $val\n";
@@ >> }
@@ >
@@ > Or without symrefs:
@@ >
@@ > foreach my $arg (qw/$v1 $v2 $v3/) {
@@ > print "name: $arg, value: ", eval $arg, "\n";
@@ > }
@@
@@ Or with strict-proof symrefs:
@@
@@ use strict;
@@
@@ # those need to be package-qualified (or our()ed or 'use var'ed)
@@ $::v1 = "foo";
@@ $::v2 = "bar";
@@ $::v3 = "baz";
@@
@@ foreach my $arg (qw/v1 v2 v3/) {
@@ print "name: \$$arg, value: ${ $::{ $arg } }\n";
@@ }
@@
@@ Not that strictures would matter here a lot, though.
Or without eval, symbolic refs and package variables:
#!/usr/bin/perl
use strict;
use warnings;
my $v1 = "foo";
my $v2 = "bar";
my $v3 = "baz";
my %v = ('$v1' => \$v1,
'$v2' => \$v2,
'$v3' => \$v3,);
foreach my $v (qw /$v1 $v2 $v3/) {
print "name: $v, value ${$v{$v}}\n";
}
__END__
Abigail
--
perl -wle'print"Κυστ αξοτθες Πεςμ Θαγλες"^"\x80"x24'
------------------------------
Date: 8 Jul 2003 19:53:24 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <bef7fk$jq3$1@nets3.rz.RWTH-Aachen.DE>
Also sprach Gunnar Hjalmarsson:
> Tassilo v. Parseval wrote:
>> Also sprach Gunnar Hjalmarsson:
>>
>>>Or without symrefs:
>>>
>>> foreach my $arg (qw/$v1 $v2 $v3/) {
>>> print "name: $arg, value: ", eval $arg, "\n";
>>> }
>>
>> Or with strict-proof symrefs:
>>
>> use strict;
>>
>> # those need to be package-qualified (or our()ed or 'use var'ed)
>> $::v1 = "foo";
>> $::v2 = "bar";
>> $::v3 = "baz";
>>
>> foreach my $arg (qw/v1 v2 v3/) {
>> print "name: \$$arg, value: ${ $::{ $arg } }\n";
>> }
>>
>> Not that strictures would matter here a lot, though.
>
> But if the variables OP is exploring include lexically scoped
> variables, symrefs isn't such a good idea, right?
Right. The whole idea is in general not very good.eval() works for both,
but is always a little cludgy, but why not? Abigail provided the answer
which is probably 'most correct' here.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
Date: Tue, 08 Jul 2003 17:12:59 -0400
From: "bd" <bdonlan@bd-home-comp.no-ip.org>
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <pan.2003.07.08.21.12.54.380061@bd-home-comp.no-ip.org>
On Tue, 08 Jul 2003 10:51:39 -0700, Eric Pement wrote:
> I have a question that's really bugging me. I've tried looking in the
> Perl FAQ, the Perl Cookbook, the White Camel, and the Perl How-to
> under words like scalars, variables, names, reference, and
> dereference. No luck. (Or if the answer was present, I didn't
> recognize it.)
>
> What I'd like to do is something like this, where foreach() is
> followed by a list of scalars:
>
> $v1 = "foo";
> $v2 = "bar";
> $v3 = "baz";
> foreach my $arg ($v1, $v2, $v3) {
> print "name: \\$arg, value: $arg\n";
> }
>
> Desired output:
>
> name: $v1, value: foo
> name: $v2, value: bar
> name: $v3, value: baz
>
> Obviously, \\$arg won't work, and I've tried 15 other constructions
> and ways of building the foreach loop, all without success. What's the
> ticket here? How do I retrieve the name of the variable instead of its
> value?
>
> Now I expect that someone will suggest that I build a hash and then
> run "foreach(sort keys %hash)" to retrieve name-value pairs. That's
> not perfectly workable for me. What I'm actually doing is debugging
> someone else's CGI script of several thousand uncommented lines, and
> at key points I need to access the simple scalars that are already
> present rather than rewriting everything. In point of fact, the
> application calls over a dozen perl scripts and setting files, and I
> don't have the time or the mandate to overhaul the entire script.
> What
> I need are some well-placed diagnostics which will be used today and
> erased tomorrow, and the answer to this question would really help.
Here's a way:
foreach my $arg (qw(v1 v2 v3)){
print "name: \$$arg, value: " . (eval "\$$arg") . "\n";
}
--
Freenet distribution not available
Three minutes' thought would suffice to find this out; but thought is
irksome and three minutes is a long time.
-- A.E. Houseman
------------------------------
Date: 8 Jul 2003 15:13:47 -0700
From: pemente@northpark.edu (Eric Pement)
Subject: Re: How to retrieve a scalar name in a foreach loop
Message-Id: <227a55e9.0307081413.6decbd6e@posting.google.com>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<bef2rm$4f99c$1@ID-184292.news.dfncis.de>...
> foreach my $arg (qw/$v1 $v2 $v3/) {
> print "name: $arg, value: ", eval $arg, "\n";
> }
This was exactly what I was looking for. Thanks!!
--
Eric Pement
------------------------------
Date: Wed, 9 Jul 2003 12:21:19 -0400
From: "Andrew" <tech7890@yahoo.com>
Subject: html table tag indent script?
Message-Id: <behf1a$md$1@news.monmouth.com>
9 July 2003
Does anyone know of a perl script I may download or have a perl script of
your own that lines up html table tags through indentation? If you have or
know of the script I would appreciate you sharing it with me. I have tried
using the html tidy program, but I never have success with it.
If you e-mail the script to me please post that you e-mailed it to the group
because I rarely check this address due to all the spam I receive now from
posting from it.
---
Andrew
------------------------------
Date: 8 Jul 2003 12:07:32 -0700
From: haukejuhls@web.de (Hauke Juhls)
Subject: Re: huge hash creates Illegal instruction (core dumped)
Message-Id: <8b3fd24d.0307081107.753c16a3@posting.google.com>
Thanks Steven, that helped me a lot!
"Steven N. Hirsch" <shirsch@adelphia.net> wrote in message news:<YIgNa.26977$Jw6.10183476@news1.news.adelphia.net>...
> #! /bin/ksh
>
> # This script modifies 32-bit XCOFF variable o_maxdata (+4C).
> # Non-zero o_maxdata uses the AIX "Large Address Space Model."
> # See "AIX: General Programming Concepts, Writing and Debugging Pgms."
>
> # exactly two parameters?
> if [[ $# = 0 ]]
> then
> print 'usage: "maxdata filename [ 0-8 ]"' ;
> print '\tThe second parameter (if present) specifies units of 256M.' ;
> print '\tIf omitted, the current value of maxdata is displayed.' ;
> print '\te.g.: "maxdata /bin/xldb 4" sets /bin/xldb maxdata to 1G.' ;
> exit ;
> fi
>
> # first parm a 32-bit xcoff?
> file $1 | grep -q 'executable (RISC System/6000) or object module' ;
> if [[ $? -ne 0 ]]
> then
> print "$1 isn't a readable 32-bit XCOFF file." ;
> exit ;
> fi
>
> if [[ $# = 1 ]]; then
> # Just display current setting.
>
> amount=`od -HAn -N4 -j76 $1 | head -1 | sed -e 's/^[ ]*//g'`
> case $amount in
> 0* ) print "$1 is not using a large address model"; exit ;;
> 1* ) int=256 ;;
> 2* ) int=512 ;;
> 3* ) int=768 ;;
> 4* ) int=1024 ;;
> 5* ) int=1269 ;;
> 6* ) int=1525 ;;
> 7* ) int=1781 ;;
> 8* ) int=2048 ;;
> esac
> print "$1 currently has maxdata setting of ${int}M"
>
> elif [[ $# = 2 ]]; then
> # Set a value
>
> # ... and writable?
> if [[ ! -w $1 ]]
> then
> print "$1 isn't a writable and executable file." ;
> exit ;
> fi
>
> # second parm equals 0,1,2,...,8 ?
> case ${2:-4} in
> [0-8] ) typeset -i8 d=${2:-4}*16 ;
> typeset -i10 m=${2:-4}*256 ;;
> * ) print 'The second parameter has to be an integer [0-8].' ;
> exit 1 ;;
> esac
>
> # Do it:
> print -n "$1 o_maxdata before: " ; od -HAx -N4 -j76 $1 | head -1 ;
>
> eval "print -n '\\0'${d#*#}'\\0\\0\\0' |
> dd of=$1 bs=4 count=1 seek=19 conv=notrunc 2>/dev/null" ;
>
> print -n "$1 o_maxdata after: " ; od -HAx -N4 -j76 $1 | head -1 ;
>
> print "Maxdata in $1 now set to ${m}M." ;
> fi
>
> --
------------------------------
Date: 9 Jul 2003 00:32:11 -0700
From: Alex_Alward@yahoo.com (Alexnotknowing)
Subject: I need some help
Message-Id: <9b5e2fb.0307082332.13bbc9f6@posting.google.com>
I need some help guys. Im trying to learn perl, and i dont know where
to start. Ive downloaded the binary format. but to be quite honest i
dont know what that means, Im a real newbie when it comes to a lot of
this stuff. I would appreciate greatly any help i can get, weather
you know a great tutorial, or can just tell me where to start, any
help is oh so much appreciated!!
Thanks
Alex
------------------------------
Date: 09 Jul 2003 07:58:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: I need some help
Message-Id: <slrnbgnioe.pr1.abigail@alexandra.abigail.nl>
Alexnotknowing (Alex_Alward@yahoo.com) wrote on MMMDXCIX September
MCMXCIII in <URL:news:9b5e2fb.0307082332.13bbc9f6@posting.google.com>:
`' I need some help guys. Im trying to learn perl, and i dont know where
`' to start. Ive downloaded the binary format. but to be quite honest i
`' dont know what that means, Im a real newbie when it comes to a lot of
`' this stuff. I would appreciate greatly any help i can get, weather
`' you know a great tutorial, or can just tell me where to start, any
`' help is oh so much appreciated!!
I'd start by learning the language. Either by reading the documentation
(which should come with perl), or by reading a (good) book.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: Wed, 09 Jul 2003 09:15:40 +0000
From: Garry Short <g4rry_short@zw4llet.com>
Subject: Re: I need some help
Message-Id: <begj4h$h3$1$8302bc10@news.demon.co.uk>
Alexnotknowing wrote:
> I need some help guys. Im trying to learn perl, and i dont know where
> to start. Ive downloaded the binary format. but to be quite honest i
> dont know what that means, Im a real newbie when it comes to a lot of
> this stuff. I would appreciate greatly any help i can get, weather
> you know a great tutorial, or can just tell me where to start, any
> help is oh so much appreciated!!
>
>
>
> Thanks
> Alex
Hi Alex,
Learning Perl : once you've got the software installed, try running "perldoc
perl" from a command prompt - that'll introduce you to the documentation
that comes with it.
If you want a book, look for O'Reilly's "Learning Perl" (there's a UNIX and
a Win32 version - try and get the right one).
Start writing scripts ASAP; the guys here are great if you post code and ask
why it doesn't work (read the posting guidelines first, though - a common
mistake people seem to make is come here, ask the impossible, get upset
when no-one gives them an answer they like, and go off in a huff).
Also, keep reading this newsgroup - there's all kinds of interesting stuff
to be learnt right here, and if you chip into a conversation and say "Hi,
I'm new - what's this piece of code doing?", you'll either generally get
the answer, or a pointer to where you can find out for yourself.
Oh, one other thing - Google Groups is your friend
(http://groups.google.co.uk) - it's got archives of all the newsgroups.
Whenever you run into a problem, look there first, to see if it's been
answered before. If you can't find anything, or don't understand what you
find, then try answering here (if it's a lack of understanding, say so - if
you say you've looked but don't understand what you've found (quote it!),
people are a lot more understanding and patient!
HTH,
Garry
------------------------------
Date: Wed, 09 Jul 2003 09:35:40 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: I need some help
Message-Id: <3F0BD3DC.2090700@bbsrc.ac.uk>
Alexnotknowing wrote:
> I need some help guys. Im trying to learn perl, and i dont know where
> to start. Ive downloaded the binary format. but to be quite honest i
> dont know what that means, Im a real newbie when it comes to a lot of
> this stuff. I would appreciate greatly any help i can get, weather
> you know a great tutorial, or can just tell me where to start, any
> help is oh so much appreciated!!
OK, you don't say which platform you're working on. It it's Windows
then get yourself over to:
http://www.activestate.com/Solutions/Programmer/Perl.plex
..and download and install ActivePerl (a binary distribution for
Windows) - it's near the bottom of the page, under resources.
If you're on any kind on Unix/Linux/MacOSX etc. then you almost
certainly have some version of perl installed already (if not
it will be somewhere in your OS distribution).
You can easily test whether you have Perl installed by typing
perl -v
..at a command line (shell / MSDOS prompt / cmd window / whatever)
You should see something like:
M:\>perl -v
This is perl, v5.6.1 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
[plus some other stuff]
Once you have perl installed then get yourself over to:
http://learn.perl.org/
..to give yourself a basic introduction to the language. Try
some stuff out, and if you get stuck then come back here with
your questions.
Also note that before you ask your question here you must read
the posting guidelines which are posted here regularly. This
will give you the best chance of getting a useful answer.
Have fun.
Simon.
------------------------------
Date: Wed, 09 Jul 2003 18:02:56 +0200
From: yoman <cobra@localhost.localdomain>
Subject: info
Message-Id: <3f0c38f1$0$26617$626a54ce@news.free.fr>
hello there !
can someone give me an explanation of the following :
let s have a script named test.pl :
#!/usr/bin/perl -w
$i=pack "h1" , "1a";
print "$i\n";
then let s do :
bash$ ./test.pl |hexdump -C
00000000 01 0a |..|
00000002
let s change the script :
#!/usr/bin/perl -w
$i=pack "h2" , "1a";
print "$i\n";
let s do :
bash$ ./test.pl |hexdump -C
00000000 c2 a1 0a |...|
00000003
so the question is :
why the 'c2' byte is here ?
thx in advance
------------------------------
Date: Wed, 9 Jul 2003 13:10:48 +0530
From: "Sharad K" <sk@usa.net>
Subject: Invoking Win32 dll from Perl.
Message-Id: <beggu4$4m7ru$1@ID-192448.news.dfncis.de>
Hi all,
I am trying to invoke a function in kernel32.dll from my perl program which
looks like this -
use Win32::API;
$GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
$PID = $GetPID->Call();
But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
contains: E:/Perl/lib E:/Perl/site/lib .
) at 1.pl line 2."
Can anyone please point me the source of the error.
Thanks in advance,
Sharad
------------------------------
Date: Wed, 09 Jul 2003 22:29:51 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Invoking Win32 dll from Perl.
Message-Id: <3F0C0ABF.962CDABB@no-spam.com>
Sharad K wrote:
>
> Hi all,
>
> I am trying to invoke a function in kernel32.dll from my perl program which
> looks like this -
>
> use Win32::API;
> $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
> $PID = $GetPID->Call();
>
> But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
> contains: E:/Perl/lib E:/Perl/site/lib .
> ) at 1.pl line 2."
>
> Can anyone please point me the source of the error.
>
The message is telling you that perl can't find the Win32::API module.
Use ppm or ppm3 to 'install' it.
C:\ppm3
<blah blah blah>
ppm> search Win32::API
Searching in Active Repositories
1. Win32-API [0.41] Perl Win32 API Import Facility
2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API support
ppm> install 1
------------------------------
Date: Wed, 9 Jul 2003 17:56:42 +0530
From: "Sharad K" <sk@usa.net>
Subject: Re: Invoking Win32 dll from Perl.
Message-Id: <beh1m5$4mdev$1@ID-192448.news.dfncis.de>
"Cat" <cat@no-spam.com> wrote in message
news:3F0C0ABF.962CDABB@no-spam.com...
> Sharad K wrote:
> >
> > Hi all,
> >
> > I am trying to invoke a function in kernel32.dll from my perl program
which
> > looks like this -
> >
> > use Win32::API;
> > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
> > $PID = $GetPID->Call();
> >
> > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
> > contains: E:/Perl/lib E:/Perl/site/lib .
> > ) at 1.pl line 2."
> >
> > Can anyone please point me the source of the error.
> >
>
> The message is telling you that perl can't find the Win32::API module.
>
> Use ppm or ppm3 to 'install' it.
>
> C:\ppm3
> <blah blah blah>
>
> ppm> search Win32::API
> Searching in Active Repositories
> 1. Win32-API [0.41] Perl Win32 API Import Facility
> 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API
support
> ppm> install 1
Thanks for the reply.
I downloaded the Win32::API perl extension from http://dada.perl.it/#api.
After installing Win32::API and putting it in the right folders I got this
error messsage -
"Can't locate loadable object for module Win32::API in @INC".
Can you tell me what is the cause of the problem now?
Thanks again,
Sharad
------------------------------
Date: Wed, 09 Jul 2003 23:12:00 +1000
From: Cat <cat@no-spam.com>
Subject: Re: Invoking Win32 dll from Perl.
Message-Id: <3F0C14A0.BE03A97F@no-spam.com>
Sharad K wrote:
>
> "Cat" <cat@no-spam.com> wrote in message
> news:3F0C0ABF.962CDABB@no-spam.com...
> > Sharad K wrote:
> > >
> > > Hi all,
> > >
> > > I am trying to invoke a function in kernel32.dll from my perl program
> which
> > > looks like this -
> > >
> > > use Win32::API;
> > > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '', 'N');
> > > $PID = $GetPID->Call();
> > >
> > > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
> > > contains: E:/Perl/lib E:/Perl/site/lib .
> > > ) at 1.pl line 2."
> > >
> > > Can anyone please point me the source of the error.
> > >
> >
> > The message is telling you that perl can't find the Win32::API module.
> >
> > Use ppm or ppm3 to 'install' it.
> >
> > C:\ppm3
> > <blah blah blah>
> >
> > ppm> search Win32::API
> > Searching in Active Repositories
> > 1. Win32-API [0.41] Perl Win32 API Import Facility
> > 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API
> support
> > ppm> install 1
>
> Thanks for the reply.
> I downloaded the Win32::API perl extension from http://dada.perl.it/#api.
> After installing Win32::API and putting it in the right folders I got this
> error messsage -
> "Can't locate loadable object for module Win32::API in @INC".
>
> Can you tell me what is the cause of the problem now?
>
> Thanks again,
> Sharad
Check that you have the modules
Win32::API::Type and
Win32::API::Struct
It looks to me that you haven't got all the ::API's installed
------------------------------
Date: Wed, 9 Jul 2003 19:01:01 +0530
From: "Sharad K" <sk@usa.net>
Subject: Re: Invoking Win32 dll from Perl.
Message-Id: <beh5eo$52ad0$1@ID-192448.news.dfncis.de>
"Cat" <cat@no-spam.com> wrote in message
news:3F0C14A0.BE03A97F@no-spam.com...
> Sharad K wrote:
> >
> > "Cat" <cat@no-spam.com> wrote in message
> > news:3F0C0ABF.962CDABB@no-spam.com...
> > > Sharad K wrote:
> > > >
> > > > Hi all,
> > > >
> > > > I am trying to invoke a function in kernel32.dll from my perl
program
> > which
> > > > looks like this -
> > > >
> > > > use Win32::API;
> > > > $GetPID = new Win32::API("kernel32", "GetCurrentProcessId", '',
'N');
> > > > $PID = $GetPID->Call();
> > > >
> > > > But ActivePerl cribs saying "Can't locate Win32/API.pm in @INC (@INC
> > > > contains: E:/Perl/lib E:/Perl/site/lib .
> > > > ) at 1.pl line 2."
> > > >
> > > > Can anyone please point me the source of the error.
> > > >
> > >
> > > The message is telling you that perl can't find the Win32::API module.
> > >
> > > Use ppm or ppm3 to 'install' it.
> > >
> > > C:\ppm3
> > > <blah blah blah>
> > >
> > > ppm> search Win32::API
> > > Searching in Active Repositories
> > > 1. Win32-API [0.41] Perl Win32 API Import Facility
> > > 2. Win32-API-OutputDebugString [0.03] OutputDebugString Win32 API
> > support
> > > ppm> install 1
> >
> > Thanks for the reply.
> > I downloaded the Win32::API perl extension from
http://dada.perl.it/#api.
> > After installing Win32::API and putting it in the right folders I got
this
> > error messsage -
> > "Can't locate loadable object for module Win32::API in @INC".
> >
> > Can you tell me what is the cause of the problem now?
> >
> > Thanks again,
> > Sharad
>
> Check that you have the modules
> Win32::API::Type and
> Win32::API::Struct
>
> It looks to me that you haven't got all the ::API's installed
Thanks a lot. I got the problem fixed.
I owe you a coffee now :-).
------------------------------
Date: Wed, 9 Jul 2003 19:45:36 +0000 (UTC)
From: Irving Kimura <irving_kimura@lycos.com>
Subject: Is www.yetanother.org down?
Message-Id: <behrd0$je7$1@reader1.panix.com>
Is www.yetanother.org down for good or just temporarily?
TIA,
-Irv
------------------------------
Date: 09 Jul 2003 22:09:11 GMT
From: "James E Keenan" <jkeen@concentric.net>
Subject: Re: Is www.yetanother.org down?
Message-Id: <bei3q7$cq7@dispatch.concentric.net>
"Irving Kimura" <irving_kimura@lycos.com> wrote in message
news:behrd0$je7$1@reader1.panix.com...
>
>
> Is www.yetanother.org down for good or just temporarily?
>
Still appears to be down.
------------------------------
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.
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 5200
***************************************