[24021] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 6218 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 5 00:05:36 2004

Date: Thu, 4 Mar 2004 21:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 4 Mar 2004     Volume: 10 Number: 6218

Today's topics:
    Re: 'require $test;' works? (David Efflandt)
    Re: 'require $test;' works? <bart.lateur@pandora.be>
    Re: accessing a hash <dwall@fastmail.fm>
    Re: accessing a hash <dwall@fastmail.fm>
    Re: accessing a hash <hillmw@charter.net>
    Re: accessing a hash <hillmw@charter.net>
    Re: Anyone got a good one-liner? <usenet@morrow.me.uk>
        FOR YOUR ONLINE BUSINESS <jennyhsm@aol.com>
    Re: If elsif beautification <bobx@linuxmail.org>
    Re: If elsif beautification <ceo@nospan.on.net>
        Installing Perl module with nmake <no_spam_for_jkeen@verizon.net>
    Re: Installing Perl module with nmake <komsbomb@hotmail.com>
    Re: Installing Perl module with nmake (Jay Tilton)
        Need to parse SQL statements...use regular expression? <x@x.us>
    Re: Nested arrays <nospam@bigpond.com>
    Re: Nested arrays <dwall@fastmail.fm>
    Re: Nested arrays <gnari@simnet.is>
    Re: new to perl <ceo@nospan.on.net>
    Re: new to perl <ceo@nospan.on.net>
    Re: passing arguments in perl with double quotes <gnari@simnet.is>
    Re: Removing accents from spanish characters <gnari@simnet.is>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 5 Mar 2004 00:58:43 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: 'require $test;' works?
Message-Id: <slrnc4fk63.up.efflandt@typhoon.xnet.com>

On Thu, 4 Mar 2004, Ravisankar Sivasubramaniam <ravisankars74@hotmail.com> 
wrote:
> I have package file as follows
> 
> test.pm
> --------
> package test;
> ...
> ...
> 1;
> -------------------------
> 
> I want to import the variables in this file to another.  The compiler goes
> through if I add
> 
> require test;
> 
> but fails with the following error message if I add
> 
> $var = test;
> require $var;
> 
> Can't locate test in @INC (@INC contains:
> /opt/perl/packages/5.004_04/sparc-sun-solaris2.6/lib
> /opt/perl/packages/5.004_04/lib
> /opt/perl/packages/5.004_04/lib/site_perl/sparc-sun-solaris2.6
> /opt/perl/packages/5.004_04/lib/site_perl .) at UpgradeNodes.pl line 26.
> 
> Can anyone tell what the problem?

Well for one thing you have a bareword when you assign $var.  If you used
warnings (-w) you might have noticed something like:

Unquoted string "test" may clash with future reserved word at ./mytest line 2.
test

-- 
David Efflandt - All spam ignored  http://www.de-srv.com/


------------------------------

Date: Fri, 05 Mar 2004 01:40:28 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: 'require $test;' works?
Message-Id: <pfmf401get47pvlvjr7l9vcq44mtat76j7@4ax.com>

Ravisankar Sivasubramaniam wrote:

>$var = test;
>require $var;

Nope, it doesn't work like that. For variables, you have to convert the
barword  to  a filename yourself. That means that you have to use
"test.pm" instead of "test", and "Foo/Bar.pm" nstead of "Foo::Bar". s
in:

	$var = "test.pm";
	require $var;
	# like: require test;

or

	$var = "Foo/Bar.pm";
	require $var;
	# like: require Foo::Bar;


-- 
	Bart.


------------------------------

Date: Thu, 04 Mar 2004 23:33:27 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: accessing a hash
Message-Id: <Xns94A2BCC6A2AE6dkwwashere@216.168.3.30>

Michael Hill <hillmw@ram.lmtas.lmco.com> wrote:

> I have this hash I'm trying to traverse and having some trouble.
> 
[cleaned up for readability]

my $var1 = {
    'database' => {
        'table' => {
            'fields' => {
                'field_name' => ['A','B','C','D']  
            },
            'name' => 'name of table'
        }
    }
};

> This works:
> 
> print "$var1->{database}->{table}->{name}\n\n";
> 
> print "$var1->{database}->{table}->{fields}->{field_name}->[0]\n";
> print "$var1->{database}->{table}->{fields}->{field_name}->[1]\n";
> print "$var1->{database}->{table}->{fields}->{field_name}->[2]\n";


A little syntactic sugar:

    print "$var1->{database}{table}{name}\n\n";

    print "$var1->{database}{table}{fields}{field_name}[0]\n";
    print "$var1->{database}{table}{fields}{field_name}[1]\n";
    print "$var1->{database}{table}{fields}{field_name}[2]\n";

will work, and it's less typing.

The arrow is optional when it is between bracket subscripts.

> Now if I want to loop through all those in:
> $var1->{database}->{table}->{fields}->{field_name} ?

Tell perl it's (a reference to) an array by putting it inside @{}

for my $element ( @{ $var1->{database}{table}{fields}{field_name} } ) {
    # do something with $element
}

> 
> Now if I force nested elements to be arrays .... like: 

Um... this code just puts anomymous hashes inside anonymous arrays.

> 
> $var2 = {
>           'database' => [
>                                  {
>                                    'table' => [
>                                                 {
>                                                   'fields' => [
>                                                                 {
>                                                                  
> 'field_name' => [
>                                                                         
>                                         
> 'A',
>                                                                         
>                                         
> 'B',
>                                                                         
>                                         
> 'C',
>                                                                         
>                                         
> 'D'
>                                                                         
>                                       
> ]
>                                                                 }
>                                                               ],
>                                                   'name' => [
>                                                               'name of
> table'
>                                                             ]
>                                                 }
>                                               ]
>                                  }
>                                ]
>         };

Cleaned up a little:

$var2 = {
    'database' => [{
        'table' => [{
            'fields' => [{
                'field_name' => ['A','B','C','D']
            }],
            'name' => ['name of table']
        }]
    }]
};

Yeesh. I don't know what you were trying to do, but I very much doubt that 
this code does it. :-)

 
> This doesn't work anymore:
> 
> print "$var2->{database}->{table}->{name}\n\n";
> 
> print "$var2->{database}->{table}->{fields}->{field_name}->[0]\n";

That's right, it doesn't, because $var is a reference to a different sort 
of data structure than that referenced by $var1.

 
> Any how would I loop though the
> $var2->{database}->{table}->{fields}->{field_name} elements array?

There is no such thing as 
$var2->{database}->{table}->{fields}->{field_name} so there's no way to 
loop through it.

-- 
David Wall


------------------------------

Date: Fri, 05 Mar 2004 02:15:57 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: accessing a hash
Message-Id: <Xns94A2D85411D54dkwwashere@216.168.3.30>

"David K. Wall" <dwall@fastmail.fm> wrote:

> Michael Hill <hillmw@ram.lmtas.lmco.com> wrote:
[snip]
>> This doesn't work anymore:
>> 
>> print "$var2->{database}->{table}->{name}\n\n";
>> 
>> print "$var2->{database}->{table}->{fields}->{field_name}->[0]\n";
> 
> That's right, it doesn't, because $var is a reference to a different sort 
> of data structure than that referenced by $var1.

Oops, make that "$var2 is a ..."


------------------------------

Date: Thu, 4 Mar 2004 21:10:03 -0600
From: "Michael Hill" <hillmw@charter.net>
Subject: Re: accessing a hash
Message-Id: <104frrbmmmlecc@corp.supernews.com>


"David K. Wall" <dwall@fastmail.fm> wrote in message
news:Xns94A2D85411D54dkwwashere@216.168.3.30...
> "David K. Wall" <dwall@fastmail.fm> wrote:
>
> > Michael Hill <hillmw@ram.lmtas.lmco.com> wrote:
> [snip]
> >> This doesn't work anymore:
> >>
> >> print "$var2->{database}->{table}->{name}\n\n";
> >>
> >> print "$var2->{database}->{table}->{fields}->{field_name}->[0]\n";
> >
> > That's right, it doesn't, because $var is a reference to a different
sort
> > of data structure than that referenced by $var1.
>
> Oops, make that "$var2 is a ..."

No wonder I was having trouble.

Mike




------------------------------

Date: Thu, 4 Mar 2004 21:15:15 -0600
From: "Michael Hill" <hillmw@charter.net>
Subject: Re: accessing a hash
Message-Id: <104fs58p3vq22ea@corp.supernews.com>

gnari, paul, David,

Thank you very much for your help.  Now that the hash problem is resolved
I'll attempt to put some logic into developing a nice script taht reads that
web service.

Again Thanks,

Mike




------------------------------

Date: Fri, 5 Mar 2004 00:30:56 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Anyone got a good one-liner?
Message-Id: <c28ho0$ag5$1@wisteria.csv.warwick.ac.uk>


"John W. Krahn" <krahnj@acm.org> wrote:
> Brad Baxter wrote:
> > 
> > Not a problem.  I'm also not sure that I'm recommending the docs be
> > changed, but the following thoughts occurred to me.
> > 
> > o It makes me think that the value of $| is stored internally as a bit.
> 
> That was my understanding, but I could be wrong.  It certainly acts like
> a one bit variable.

No. If it was a one bit variable then

$| = 1; $|++;

would overflow to 0 again. Assigning to $| is more like calling

sub set_dollarpipe {
    $| = (0 + $_[0]) ? 1 : 0;
}

 .

Ben

-- 
   Although few may originate a policy, we are all able to judge it.
                                             - Pericles of Athens, c.430 B.C.
  ben@morrow.me.uk


------------------------------

Date: Thu, 4 Mar 2004 23:00:00 +0800
From: "Jenny" <jennyhsm@aol.com>
Subject: FOR YOUR ONLINE BUSINESS
Message-Id: <404744d7$11@newsgate.hknet.com>

Hello,

A very promising program on the net  finally evolved ... the great thing about
it is they market it
for you!

Easy, once you join all of this happens without you lifting a finger!


All you have to do is Join.

I think this has huge potential & could really take
off this year (program has just started)... once you
grasp the scale of what those that are in early could
make, you can see why I really like the look of this
(and it will appeal to all those that struggle to find
their own recruits!)

Anyway, have a good look around & decide for yourself

http://tinyurl.com/3bz48



Wishing you PROSPERITY......










------------------------------

Date: Thu, 04 Mar 2004 20:14:59 -0500
From: Robert <bobx@linuxmail.org>
Subject: Re: If elsif beautification
Message-Id: <87OdnXrEmPUSSdrdRVn-vw@adelphia.com>

Glenn Jackman wrote:

> Sharif Islam <mislam@spamless.uiuc.edu> wrote:
> 
>> Based on some matched patterns I am setting the var $id and applying two 
>> functions -- code snippet below. The code looks really ugly when I have 
>> 25 elsif statements for the match. The parts that are different on each 
>> line are the url pattern and the id. I am applying the same two 
>> functions in each line. Is there any way to combine the if/elsif 
>> statements and the function calls? Thanks.
>> 
>> 
>> foreach $line (@url) {
>> 
>> if ($line =~ /google.com/) { print "----\n$line\n" ;  $id =55 ; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh,$id); }
>> elsif ($line =~ /slashdot.org/) { print "---\n$line\n" ; $id = 64; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh;$id); }
>> elsif ($line =~ /yahoo.com/) { print "---\n$line\n" ; $id = 12; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh;$id); }
>> 
>> #20 or so pattern match
>> 
>>    }
> 
> 
> 
> Whitespace won't kill you.
> 
[...]

No. But in some languages it's mandatory!  ;-)


------------------------------

Date: Fri, 05 Mar 2004 04:14:54 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: If elsif beautification
Message-Id: <29T1c.55758$vU3.47723@newssvr33.news.prodigy.com>

Glenn Jackman wrote:
> Sharif Islam <mislam@spamless.uiuc.edu> wrote:
> 
>> Based on some matched patterns I am setting the var $id and applying two 
>> functions -- code snippet below. The code looks really ugly when I have 
>> 25 elsif statements for the match. The parts that are different on each 
>> line are the url pattern and the id. I am applying the same two 
>> functions in each line. Is there any way to combine the if/elsif 
>> statements and the function calls? Thanks.
>> 
>> 
>> foreach $line (@url) {
>> 
>> if ($line =~ /google.com/) { print "----\n$line\n" ;  $id =55 ; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh,$id); }
>> elsif ($line =~ /slashdot.org/) { print "---\n$line\n" ; $id = 64; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh;$id); }
>> elsif ($line =~ /yahoo.com/) { print "---\n$line\n" ; $id = 12; 
>> myFunction($dbh,$line,$id); myAnotherFunction($dbh;$id); }
>> 
>> #20 or so pattern match
>> 
>>    }
> 
> 
> 
> Whitespace won't kill you.
> 
>     foreach $line (@url) {
>         my $id;  # an undefined value
> 
>         if    ($line =~ /google.com/)   { $id = 55; }
>         elsif ($line =~ /slashdot.org/) { $id = 64; }
>         elsif ($line =~ /yahoo.com/)    { $id = 12; }
>         #...
> 
>         next unless $id;
>         
>         # now that an id is set, do something with it:
>         print "----\n$line\n";
>         myFunction($dbh,$line,$id); 
>         myAnotherFunction($dbh,$id);
>     }
>             

<2_CENTS>
Applause, applause...  It's incredible how much more readable (and 
maintainable) that is.  This is one of pet peeves -- code that looks 
like garbage (and in general, as a consequence, IS garbage).

It's amazing how much garbagy looking code I see even from so called 
"gurus" (in ANY language).  Programming novices need to see more of this 
when the helping hand is given.  (Not taking away from the better hashed 
based approach which is better in the case of the actual objective.)
</2_CENTS>

Chris
-----
Chris Olive
chris -at- --spammer-speed-bump-- technologEase -dot- com
http://www.technologEase.com
(pronounced "technologies")


------------------------------

Date: Fri, 05 Mar 2004 01:34:44 GMT
From: "Jim Keenan" <no_spam_for_jkeen@verizon.net>
Subject: Installing Perl module with nmake
Message-Id: <UOQ1c.40327$6K.2725@nwrddc02.gnilink.net>

This posting does not concern Perl code.  It concerns the use of 'nmake' to
install a Perl module on a Windows98 system.  If you deem this off-topic or
want to rant about why I am still using a Win98 box, stop reading here.

I have developed a number of Perl modules in a Linux environment using the
standard MakeMaker approach.  Once these modules have been tested and
installed on Linux, I send the tarball to my Win98 box and repeat the
process with 'nmake' (v1.50).  Heretofore, have never had any difference in
results, and two of these modules have been uploaded to CPAN where they
passed all tests on both *nix and Windows.

Tonight I followed the same procedure with a new module.  Everything fine on
Linux.  On Windows, when I called 'nmake test', I got a screen full of
warning messages and indications that most of the tests failed.  But I
couldn't get a clear reading on the errors, because the DOS-prompt doesn't
permit me to scroll backwards far enough.

I got this far with the previous version of the module a couple of days ago.
For fun, I went ahead and called 'nmake install' -- and the module installed
correctly!

Tonight I tried a different approach.  I shifted to the Cygwin BASH prompt
after calling 'perl Makefile.PL' and 'nmake'.  I then called 'nmake test' --
and this time all 200 tests passed, just as they had done on Linux!  I then
proceeded to 'nmake install', which, as before, proceeded correctly.

So has anyone seen this problem before? 'nmake test' gives 1 (wrong) result
from the DOS-prompt and a different (correct) result from the Cygwin
BASH-prompt.

Jim Keenan




------------------------------

Date: Fri, 5 Mar 2004 09:51:17 +0800
From: "Koms Bomb" <komsbomb@hotmail.com>
Subject: Re: Installing Perl module with nmake
Message-Id: <c28mdd$1q5h64$1@ID-165313.news.uni-berlin.de>

> This posting does not concern Perl code.  It concerns the use of 'nmake'
to
> install a Perl module on a Windows98 system.  If you deem this off-topic
or
> want to rant about why I am still using a Win98 box, stop reading here.

I use both Win98 and Win2k :-)

> Tonight I followed the same procedure with a new module.  Everything fine
on
> Linux.  On Windows, when I called 'nmake test', I got a screen full of
> warning messages and indications that most of the tests failed.  But I
> couldn't get a clear reading on the errors, because the DOS-prompt doesn't
> permit me to scroll backwards far enough.

'nmake test | more' can pause the scrolling or 'nmake test > result.txt' can
redirect the message to a file, so you can read and analyse them.


--
Koms Bomb

*****Pardon my poor English*****
---------------------
My TASM homepage, resource for assembly. Tools, articles, links.
http://komsbomb.ols-lab.com




------------------------------

Date: Fri, 05 Mar 2004 03:00:12 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Installing Perl module with nmake
Message-Id: <4047ed35.28542273@news.erols.com>

"Jim Keenan" <no_spam_for_jkeen@verizon.net> wrote:

: Tonight I followed the same procedure with a new module.

What was that module?  Is it available on CPAN?  A reader (like me) who is
interested in reproducing the bad result could use that information.

: Everything fine on
: Linux.  On Windows, when I called 'nmake test', I got a screen full of
: warning messages and indications that most of the tests failed.  But I
: couldn't get a clear reading on the errors, because the DOS-prompt doesn't
: permit me to scroll backwards far enough.

The output from nmake can be redirected to a file or piped into a pager.
 
: I got this far with the previous version of the module a couple of days ago.
: For fun, I went ahead and called 'nmake install' -- and the module installed
: correctly!

That's not especially surprising.

: Tonight I tried a different approach.  I shifted to the Cygwin BASH prompt
: after calling 'perl Makefile.PL' and 'nmake'.  I then called 'nmake test' --
: and this time all 200 tests passed, just as they had done on Linux!  I then
: proceeded to 'nmake install', which, as before, proceeded correctly.
: 
: So has anyone seen this problem before? 'nmake test' gives 1 (wrong) result
: from the DOS-prompt

Yes.  I've seen it when the test procedure depends on a unix-like shell
that can redirect STDERR.

: and a different (correct) result from the Cygwin
: BASH-prompt.

Never tried.  If the the test procedure isn't windows-savvy, I'm not very
confident that the module will work correctly in a windows environment.



------------------------------

Date: Thu, 4 Mar 2004 21:55:59 -0600
From: "Justin F" <x@x.us>
Subject: Need to parse SQL statements...use regular expression?
Message-Id: <jTS1c.10175$m4.5448@okepread03>

I'm developing a tool that will be used to write queries against a database.
The word 'GO' is used as a batch terminator...for example, two queries
separated by 'GO' would need to be sent to the database separately. I can
can accomplish this if 'GO' appears on it's own line, but that won't always
be the case...it may be in a comment or contained in a string, in which case
I don't want to match.

Here are some examples of when I DON'T want to match 'GO':
On a commented line ('--' marks a commented line):
  select * from users
  -- don't match this go
  select * from users2

Within a comment block ('/*' opens the block, and '*/' closes it):
  select * from users
  /*
  don't match this go
  */
select * from users2

Within a string (single qoutes delimit a string):
  select 'don't match this go'

DO match these two:
  select * from users go select * from users2

  select * from users
  go
  select * from users2


I really don't know much about regular expressions...can this be
accomplished with one? If so, what would the expression look like?

-Justin




------------------------------

Date: Fri, 05 Mar 2004 09:38:48 +1000
From: Gregory Toomey <nospam@bigpond.com>
Subject: Re: Nested arrays
Message-Id: <2705184.kR32195bev@GMT-hosting-and-pickle-farming>

Sandman wrote:

> Using php, an array definition might look like this:
> 
>     $foo = array(
>         "foo" => array("foo", "bar"),
>         "bar" => array("rab", "oof")
>     );
> 
>     print $foo["foo"][0];
> 
> ...would print "foo"
> 
>     $foo = array(
>         "foo" => array("foo" => "orange", "bar" => "apple"),
>         "bar" => array("rab" => "pear", "oof" => "pineapple")
>     );
> 
>     print $foo["foo"][0];
>     print $foo["foo"]["foo"];
> 
> ...would both print "orange".
> 
> How would the syntax be in perl? Perl differantiates betwen hashes and
> arrays, and in php an array is an hash and an array at the same time (i.e.
> every key in the array exists as both named and as index).
> 

See the Data Structures Cookbook
http://www.perl.com/doc/FMTEYEWTK/pdsc/

gtoomey


------------------------------

Date: Thu, 04 Mar 2004 23:47:43 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Nested arrays
Message-Id: <Xns94A2BF322D79Ddkwwashere@216.168.3.30>

Sandman <mr@sandman.net> wrote:

> Using php, an array definition might look like this:
> 
>     $foo = array(
>         "foo" => array("foo", "bar"),
>         "bar" => array("rab", "oof")
>     );
> 
>     print $foo["foo"][0];
> 
> ...would print "foo"
> 
>     $foo = array(
>         "foo" => array("foo" => "orange", "bar" => "apple"),
>         "bar" => array("rab" => "pear", "oof" => "pineapple")
>     );
> 
>     print $foo["foo"][0];
>     print $foo["foo"]["foo"];
> 
> ...would both print "orange".
> 
> How would the syntax be in perl? Perl differantiates betwen hashes and
> arrays, and in php an array is an hash and an array at the same time
> (i.e. every key in the array exists as both named and as index).

You can answer this for yourself by reading one or more (preferably all) of 
perlreftut, perlref, and perldsc.  Read perldsc first if you want to go 
straight to examples without all the information on references.

Reading up on syntax is the easy part of learning a language. If syntax 
were all there was to it I'd already know Python and Ruby... but I don't.



------------------------------

Date: Thu, 4 Mar 2004 23:07:52 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Nested arrays
Message-Id: <c28cq6$f1a$1@news.simnet.is>

"Sandman" <mr@sandman.net> wrote in message
news:mr-12CDF3.23193804032004@news.fu-berlin.de...
> Using php, an array definition might look like this:
>
>     $foo = array(
>         "foo" => array("foo", "bar"),
>         "bar" => array("rab", "oof")
>     );
>
>     print $foo["foo"][0];
>
> ...would print "foo"

    %foo =

                      'foo' => ['foo','bar'],
                      'bar' => ['rab','oof']
                 );
    print $foo{'foo'}[0];

prints "foo"


>
>     $foo = array(
>         "foo" => array("foo" => "orange", "bar" => "apple"),
>         "bar" => array("rab" => "pear", "oof" => "pineapple")
>     );
>
>     print $foo["foo"][0];
>     print $foo["foo"]["foo"];
>
> ...would both print "orange".

    %foo = (
                   'foo' => {'foo' => 'orange' , 'bar => 'apple'},
                   'bar' => {'rab' => 'pear'    , 'rab => 'pimeapple'}
                 );
    print $foo{'foo}{'foo'};

prints "orange"

    print $foo{foo}[0];

is an error;

gnari





------------------------------

Date: Fri, 05 Mar 2004 03:49:32 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: new to perl
Message-Id: <gNS1c.55746$7N3.22596@newssvr33.news.prodigy.com>

Scott Bryce wrote:
> Regent wrote:
> 
>> Oh really. Does this mean the shebang can be omitted, if no switch is 
>> used?
> 
> 
> I believe the correct answer is, It depends.
> 
> If your system is configured to look up the .pl extension in the system 
> registry and determine from that to use the perl interpreter to run the 
> script, then the shebang can be left out. Otherwise, you need to leave 
> it in.
> 

I don't believe this correct, not that it matters a tremendous deal. 
Under Windump If there is no association with .pl to run perl.exe, then 
Windump doesn't know WHAT to do with it and it punts.  You would have to 
preface your script with 'perl' to get it to run in which case you could 
just as easily name it .txt and it would still work:

C:\> script.pl
'script.pl' is not recognized as an internal or external command,
operatable program or batch file.

C:\> type script.pl
print "This is all there is in here!\n";

C:\> perl script.pl
This is all there is in here!

C:\> copy script.pl script.txt
C:\> perl script.txt
This is all there is in here!

C:\> assoc .pl=Perl
C:\> ftype Perl=c:\perl\bin\perl.exe  %1 %*
C:\> script.pl
This is all there is in here!


I think any way you cut it, the she-bang is not required in Windump 
unless you want to pass a switch like -w or -T.

None of this will help the OP, but maybe is worth something.

chris
-----
Chris Olive
chris -at- --spammer-speed-bump-- technologEase -dot- com
http://www.technologEase.com
(pronounced "technologies")


------------------------------

Date: Fri, 05 Mar 2004 03:54:44 GMT
From: Chris <ceo@nospan.on.net>
Subject: Re: new to perl
Message-Id: <8SS1c.55750$rQ3.37440@newssvr33.news.prodigy.com>

Joe Smith wrote:
> Tsui Wai-ming wrote:
> 
>> In fact I just changed to
>>
>> #!C:\perl\bin\perl
>>
>> This one
>> # perl, and
>> #!C:\perl\bin
>>
>> didnt work at all...
> 
> 
> It depends on how you invoke your perl script.
> 
> Double-clicking on an icon in a local file folder: Uses registry.
> Typing name into CMD.EXE command-line prompt: Uses registry.
> Typing name into some other command-line shell: Depends on shell (bash).
>    (In particular, cygwin uses /usr/bin/perl.)
> Clicking on link in a browser: Depends on web server.

Absolutely.

>    Sambar Server for Windows: Uses shebang line.
>    Apache Server for Windows: I believe it is a configuration option.
>    IIS: Registry.

Nope.  IIS needs an association set in it's configuration to get .pl 
files to work as CGI.  And the directory the .pl scripts are in has to 
be set to "Scripts and Executables" ('Scripts' meaning .asp pages, not 
CGI).  And all IIS settings get stored in the IIS meta-base (separate, 
very hokied up file), not the registry up through IIS v5.1.  IIS 6.0 
uses an XML meta-base.  The registry is not used (as far as I know up 
through v5.1).

Chris
-----
Chris Olive
chris -at- --spammer-speed-bump-- technologEase -dot- com
http://www.technologEase.com
(pronounced "technologies")


------------------------------

Date: Thu, 4 Mar 2004 22:59:41 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: passing arguments in perl with double quotes
Message-Id: <c28car$esb$1@news.simnet.is>

"Paul Lalli" <ittyspam@yahoo.com> wrote in message
news:20040304162045.B27834@dishwasher.cs.rpi.edu...
> On Thu, 4 Mar 2004, Samantha wrote:
>
>
> > I would like arg1 to be "1 2" and not just 1 2
> > It looks like the " are being stripped out of the argument by the
> > parser. Similarly, I would like:
>
> This isn't perl's doing, it's the shell.  Quotes are a special character
> that mean "all of the following until the next quote are one argument,
> regardless of space".  If you want to include actual quote characters in
> your argument, you do:
> ./test hello \"1\ 2\"

or
  ./test hello '"1 2"'

gnari





------------------------------

Date: Thu, 4 Mar 2004 22:53:09 -0000
From: "gnari" <gnari@simnet.is>
Subject: Re: Removing accents from spanish characters
Message-Id: <c28buj$erf$1@news.simnet.is>

"Henry Law" <lawshouse.public@btconnect.com> wrote in message
news:5l8f40dvaa6cnhesp360ju31smiu4krshs@4ax.com...
> On Thu, 04 Mar 2004 10:46:12 +0000, Helgi Briem
> <HelgiBriem_1@hotmail.com> wrote:
>
> >my $text = 'Þjóðlegir þýskir ferðamenn líða ekki fúlar fréttir';
>
> unless ($worried_about_flames) {
> print "What a wonderful looking language\n",
> "What does that mean in English?";

Something like
Traditional german tourists do not tolerate bad news

gnari






------------------------------

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 6218
***************************************


home help back first fref pref prev next nref lref last post