[23556] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5764 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Nov 7 14:05:46 2003

Date: Fri, 7 Nov 2003 11:05:10 -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           Fri, 7 Nov 2003     Volume: 10 Number: 5764

Today's topics:
    Re: [newbie] How to pass in perl variables between web  (Pedro)
    Re: [newbie] How to pass in perl variables between web  (Pedro)
    Re: [newbie] How to pass in perl variables between web  <nobull@mail.com>
    Re: [newbie] How to pass in perl variables between web  (Tad McClellan)
        binary dist calculation <fJogham@yahoo.com>
    Re: binary dist calculation <nobull@mail.com>
    Re: binary dist calculation <tassilo.parseval@rwth-aachen.de>
        Checking environment variable existence <victor.hannak@nospam.kodak.com>
    Re: Checking environment variable existence <glex_nospam@qwest.invalid>
    Re: Checking environment variable existence <ak+usenet@freeshell.org>
    Re: Checking environment variable existence <uri@stemsystems.com>
    Re: Checking environment variable existence <nobull@mail.com>
    Re: embedding perl within perl.... <tobert@NOSPAMtobert.org>
        How to remove javascript tag by perl <jjliu@earthlink.net>
    Re: How to remove javascript tag by perl <nobull@mail.com>
        mod_perl vs velocigen (Krusty)
    Re: mod_perl vs velocigen <glex_nospam@qwest.invalid>
        newbie 4th JaPH <hexkid@hotpop.com>
    Re: Perl features <jwillmore@remove.adelphia.net>
    Re: Perl features <noemail@noemail4u.com>
        searching for null in pattern (Brian Andrus)
    Re: Tool to embed images (or other binaries)  in your P <m_arc@world.std.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 07 Nov 2003 16:23:06 +0000
From: pedro.fabre.NO-SPAM@gen.gu.se (Pedro)
Subject: Re: [newbie] How to pass in perl variables between web pages?
Message-Id: <pedro.fabre.NO-SPAM-0711031623060001@192.168.0.5>

In article <boblii$3e$3@wisteria.csv.warwick.ac.uk>, Ben Morrow
<usenet@morrow.me.uk> wrote:

> pedro.fabre.NO-SPAM@gen.gu.se (Pedro) wrote:
> > I am trying to pass the whole set of variables from a page to the result
> > one and then process this result on the output file. I know that this can
> > be bone on perl but I have no idea, how to do it. Or where to look
> > information related to that.
> 
> perldoc CGI

OK I realised that CGI is a parser for normal get and post. but I am still
confused because if I have a reference to an array:



$VAR1 = [ '139495', '1984584', '3927', '132902', '132914', '202613',
'79008', '738140', '137831', '132761', '132768', '739134', '768414',
'715498', '4512', '1569451', '133291' ];

and I pass this value in a form as hidden
          <input type="hidden" name="snp_id_list" value="$id_list">


, on the response page

I called using

my $q = new CGI;

my $r =Apache->request();

my $id_list = $q->param('id_list');

print "\n[snp_id_list]\n";
print Dumper $snp_id_list; 

and I get [id_list] $VAR1 = 'ARRAY(0x17430a4)'

the reference to the memory position and not the values.

What I am doing wrong?

Thanks
Pedro


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

Date: Fri, 07 Nov 2003 16:31:51 +0000
From: pedro.fabre.NO-SPAM@gen.gu.se (Pedro)
Subject: Re: [newbie] How to pass in perl variables between web pages?
Message-Id: <pedro.fabre.NO-SPAM-0711031631510001@192.168.0.5>

In article <boblii$3e$3@wisteria.csv.warwick.ac.uk>, Ben Morrow
<usenet@morrow.me.uk> wrote:

> pedro.fabre.NO-SPAM@gen.gu.se (Pedro) wrote:
> > I am trying to pass the whole set of variables from a page to the result
> > one and then process this result on the output file. I know that this can
> > be bone on perl but I have no idea, how to do it. Or where to look
> > information related to that.
> 
> perldoc CGI


I also have noticed that if I dereference the variable. I go the values.
but This works just for a first level. Is there any way to pass a
multilevel variable from page to page?



Cheers
Pedro


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

Date: 07 Nov 2003 17:42:00 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: [newbie] How to pass in perl variables between web pages?
Message-Id: <u93cd0qdnb.fsf@wcl-l.bham.ac.uk>

pedro.fabre.NO-SPAM@gen.gu.se (Pedro) writes:

> In article <boblii$3e$3@wisteria.csv.warwick.ac.uk>, Ben Morrow
> <usenet@morrow.me.uk> wrote:
> 
> > pedro.fabre.NO-SPAM@gen.gu.se (Pedro) wrote:
> > > I am trying to pass the whole set of variables from a page to the result
> > > one and then process this result on the output file. I know that this can
> > > be bone on perl but I have no idea, how to do it. Or where to look
> > > information related to that.
> > 
> > perldoc CGI
> 
> OK I realised that CGI is a parser for normal get and post. but I am still
> confused because if I have a reference to an array:

Then you have a reference to an array.
> 
> 
> 
> $VAR1 = [ '139495', '1984584', '3927', '132902', '132914', '202613',
> '79008', '738140', '137831', '132761', '132768', '739134', '768414',
> '715498', '4512', '1569451', '133291' ];
> 
> and I pass this value in a form as hidden
>           <input type="hidden" name="snp_id_list" value="$id_list">

HTML documents are just strings.  The values of fields in HTML forms
are just strings.

You are just interpolating $id_list as a string.

But as you said $id_list doesn't contain a string, it contains a
reference to an array.

> on the response page
> 
> and I get [id_list] $VAR1 = 'ARRAY(0x17430a4)'
> 
> the reference to the memory position and not the values.

Yep.  That's what you get (by default) in Perl if you use a reference
in string context.

> What I am doing wrong?

Making shit up and expecting the computer to know what you mean.  You
can't do that.

If you want to construct a string that represents a data structure
then you need to use something that takes the data structure in
question and produces a string and something else that can take the
string and reproduce the data structure.

For a simple array you could just use join/split (so long as there's a
delimiter character you know will not appear in your data).

For arbitrary unblessed Perl data structures you should use a module
like Storable.  (See CPAN for alternative data serialisation modules).

I'd advise against Data::Dumper and eval() since this would allow
people to execute arbitrary code on your server.

Since putting unprintable characters in HTML fields is probably not a
good idea you'll also want a module like MIME::Base64.  For good
measure I'd also throw in a compression module and a symetric cypher
module.

Note, of course, that the strong crypto is still only as secure as the
environment variable settings on your seb server.  Still it will do a
reasonable job of hiding stuff from the casual observer who doesn't
have access to your server.

use Storable qw( freeze thaw );
use MIME::Base64;
use Compress::Zlib qw( compress uncompress );
require Crypt::CBC;

my $cipher = Crypt::CBC->new($ENV{CRYPTO_KEY},'Blowfish');

sub encode {
    encode_base64(compress($cipher->encrypt(freeze(shift))),'');
}

sub decode {
    my $state = shift;
    return unless $state;
    thaw($cipher->decrypt(uncompress(decode_base64($state))));
}


-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 7 Nov 2003 11:46:22 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [newbie] How to pass in perl variables between web pages?
Message-Id: <slrnbqnmje.52c.tadmc@magna.augustmail.com>

Pedro <pedro.fabre.NO-SPAM@gen.gu.se> wrote:

> Subject: [newbie] How to pass in perl variables between web pages?


It is not possible to pass variables between web pages.


( It is, however, possible to pass *values* between web pages. )


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Sat, 08 Nov 2003 04:27:11 +1100
From: Fred <fJogham@yahoo.com>
Subject: binary dist calculation
Message-Id: <3FABD5EF.8050201@yahoo.com>

Hello
I am trying to calculate the distance between 2 binary data arrays
it is puting out errors but I don't know why or how to fix it.
I guss if I spend a day or 2 reading I may know why and fix it but after 
1/2 hr or trail and error I gave up.


thanks

my @bit1 = qw /01 10 01 01 01/;
my @bit2 = qw /01 00 11 01 00/;
print (dist(\@bit1, \@bit2), "\n"); pass array ref to sub

sub dist {
     my $fst = shift;  #grab the first array
     my $x = join("", @{$fst});  #de-ref into a string
     my $X = "0b$x";  #concate "0b" infront for the "^" xOR operator
     my $scd = shift;
     my $y = join("", @{$scd});
     my $Y = "0b$y";
     my $answer = sprintf "%b", $X ^ $Y; #xOR($X, $Y)
     return ($answer =~ tr/1//);	#grab how many 1s
}



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

Date: 07 Nov 2003 18:06:02 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: binary dist calculation
Message-Id: <u9wuacoxyt.fsf@wcl-l.bham.ac.uk>

Fred <fJogham@yahoo.com> writes:

> sub dist {
>      my $fst = shift;  #grab the first array
>      my $x = join("", @{$fst});  #de-ref into a string
>      my $X = "0b$x";  #concate "0b" infront for the "^" xOR operator

Bzzt...

If $_[0] was [ qw /01 10 01 01 01/ ] you don't want $X to contain the
string "0b0110010101" you want $X to contain the number 0b0110010101
(aka 405).

You can convert "0b0110010101" into 405 using oct() (or, if you are
feeling perverse, eval()).

>      my $scd = shift;
>      my $y = join("", @{$scd});
>      my $Y = "0b$y";
>      my $answer = sprintf "%b", $X ^ $Y; #xOR($X, $Y)

If you observe yourself doing the same thing multiple times using sets
of sequentially named variables (fst,scd.. x,y... X,Y...) then you
should experience a binding headache and the words "LOOP" and "ARRAY"
should appear to float in the air in front of you.

my @oper = map { oct("0b" . join("",@$_)) } @_;
my $answer = sprintf "%b", $oper[0] ^ $oper[1];

You could even use List::Util::reduce().

my $answer = sprintf "%b", reduce { $a ^ $b } map { oct("0b" . join("",@$_)) } @_;

But that's probably just silly.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 7 Nov 2003 18:30:00 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: binary dist calculation
Message-Id: <bogob8$7fe$1@nets3.rz.RWTH-Aachen.DE>

Also sprach Fred:

> I am trying to calculate the distance between 2 binary data arrays
> it is puting out errors but I don't know why or how to fix it.
> I guss if I spend a day or 2 reading I may know why and fix it but after 
> 1/2 hr or trail and error I gave up.
> 
> 
> thanks
> 
> my @bit1 = qw /01 10 01 01 01/;
> my @bit2 = qw /01 00 11 01 00/;
> print (dist(\@bit1, \@bit2), "\n"); pass array ref to sub
> 
> sub dist {
>      my $fst = shift;  #grab the first array
>      my $x = join("", @{$fst});  #de-ref into a string
>      my $X = "0b$x";  #concate "0b" infront for the "^" xOR operator
>      my $scd = shift;
>      my $y = join("", @{$scd});
>      my $Y = "0b$y";
>      my $answer = sprintf "%b", $X ^ $Y; #xOR($X, $Y)
>      return ($answer =~ tr/1//);	#grab how many 1s

You don't need the sprintf converstion. A simpler version would look
like:

    sub dist {
        my $x = join "", @{ shift() };
        my $y = join "", @{ shift() };
        return ($x ^ $y) =~ tr/\001//;
    }

The problem in your solution was that you counted the 1's. However, you
have to count the occurances of \001 (that is, the second character in
the ASCII character set). "1" has the value 49 (or maybe even a
different one in EBCDIC encoding, don't know).

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: Fri, 7 Nov 2003 11:19:55 -0500
From: "Victor Hannak" <victor.hannak@nospam.kodak.com>
Subject: Checking environment variable existence
Message-Id: <boggp9$q9$1@news.kodak.com>

Is there an >easy< way to tell if an environment variable exists without
getting a "use of uninitialized variable" error in Perl?

I know I could probably cycle through the entire %ENV array and look for a
match, but I was hoping there was a better way...




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

Date: Fri, 07 Nov 2003 10:30:17 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: Checking environment variable existence
Message-Id: <aJPqb.955$U87.22051@news.uswest.net>

Victor Hannak wrote:
> Is there an >easy< way to tell if an environment variable exists without
> getting a "use of uninitialized variable" error in Perl?
> 
> I know I could probably cycle through the entire %ENV array and look for a
> match, but I was hoping there was a better way...

You answered your own question. :-)

perldoc -f exists



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

Date: Fri, 7 Nov 2003 16:34:44 +0000 (UTC)
From: Andreas Kahari <ak+usenet@freeshell.org>
Subject: Re: Checking environment variable existence
Message-Id: <slrnbqnid2.iem.ak+usenet@vinland.freeshell.org>

In article <boggp9$q9$1@news.kodak.com>, Victor Hannak wrote:
> Is there an >easy< way to tell if an environment variable exists without
> getting a "use of uninitialized variable" error in Perl?
> 
> I know I could probably cycle through the entire %ENV array and look for a
> match, but I was hoping there was a better way...

%ENV is a hash, not an array.


    if (exists $ENV{MYVAR} && defined $ENV{MYVAR}) {
	# The MYVAR environment variable exists and is not undef
    }


-- 
Andreas Kähäri


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

Date: Fri, 07 Nov 2003 16:57:31 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Checking environment variable existence
Message-Id: <x7ad785d6t.fsf@mail.sysarch.com>

>>>>> "AK" == Andreas Kahari <ak+usenet@freeshell.org> writes:

  AK>     if (exists $ENV{MYVAR} && defined $ENV{MYVAR}) { # The MYVAR
  AK> environment variable exists and is not undef
  AK>     }

if the environment is set from the outside and not modified in the perl
script, then you can't get undefined entries. the env in c is a array of
strings of the form key=value so at the minimum you get a value of an
empty string (which is defined). so you can drop the defined (or the
exists) test above in most cases.

uri

-- 
Uri Guttman  ------  uri@stemsystems.com  -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------  http://jobs.perl.org


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

Date: 07 Nov 2003 17:16:45 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Checking environment variable existence
Message-Id: <u9d6c4qete.fsf@wcl-l.bham.ac.uk>

Uri Guttman <uri@stemsystems.com> writes:

> >>>>> "AK" == Andreas Kahari <ak+usenet@freeshell.org> writes:
> 
>   AK>     if (exists $ENV{MYVAR} && defined $ENV{MYVAR}) { # The MYVAR
>   AK> environment variable exists and is not undef
>   AK>     }
> 
> if the environment is set from the outside and not modified in the perl
> script, then you can't get undefined entries. 

Indeed if you are in the habit of using warnings and making sure your
programs don't generate warnings then you can be fairly sure there
won't be any undefs in %ENV even if you _have_ modified the environment
within the Perl script.

And, of course, you can also be sure that for any element of a
non-magical hash (or for a well-behaved magical one like %ENV)
defined() can never be true if exists() is false.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 07 Nov 2003 18:02:00 GMT
From: Al Tobey <tobert@NOSPAMtobert.org>
Subject: Re: embedding perl within perl....
Message-Id: <5554788c673bc9712f3f43e9b7e91dd1@news.teranews.com>

On Thu, 06 Nov 2003 07:09:32 +0000, suraj wrote:

> Hello,
> 
> i have a strange situation. i am writing a perl extension on win32 with
> perl 5.6 from activestate.
> 
> however, this might be a general situation somebody might get into and
> hence hoping some perl gurus might be able to answer me.
> 
> 1. i have written a XS extention in C++ which provides some
> functionality. i wrote a small test perl script and everything works
> fine.
> 
> 2. however, now i have to enhance the functionality in the C++ layer of
> this extension so that it does some code execution/expression parsing at
> runtime. i wanted to use the perl engine to do this since perl is so
> flexible and powerful.

perldoc -f eval

> 3. so i tried to embed perl in the way described in the perl embed man
> pages and so now i have a perl extension embedding perl inturn. it
> compiled ok but now crashes at random places when i hit that code.

This is probably not a good idea.  What you probably want is eval() which
can interpret and execute code at runtime.  Your C/C++ module could pass
code into the perl interpreter and eval it there, or your perl code can
eval it directly.

file1.pl:
print "bar\n";

file2.pl:
#!/usr/bin/perl
open( X, "<file1.pl" );
$/ = undef;
my $code = <X>;
close( X );
eval( $code );

> file2.pl
bar


> does anybody know if this is possible at all? is
there any help about
> this in any manpages. i tried couple of them but most of them talk about
> using perl in a C/C++ executable. but my situation is not this straight
> forward. i have perl using a C++ extension which tries to embed perl in
> turn.
> 
> thanks for any help,
> suraj bhide.


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

Date: Fri, 07 Nov 2003 17:07:22 GMT
From: "jjl" <jjliu@earthlink.net>
Subject: How to remove javascript tag by perl
Message-Id: <ejQqb.15281$9M3.14396@newsread2.news.atl.earthlink.net>

Could someone help me on how to remove javascript tag from HTML file by
perl, such as

<script language='javascript'> something </script>

I want to remove two script tags and something between tags. Thanks for your
help.




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

Date: 07 Nov 2003 17:17:48 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: How to remove javascript tag by perl
Message-Id: <u97k2cqern.fsf@wcl-l.bham.ac.uk>

"jjl" <jjliu@earthlink.net> writes:

> Could someone help me on how to remove javascript tag from HTML file by
> perl, such as
> 
> <script language='javascript'> something </script>
> 
> I want to remove two script tags and something between tags. Thanks for your
> help.

HTML::Filter would be the obvious way.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 7 Nov 2003 10:23:15 -0800
From: danparker276@yahoo.com (Krusty)
Subject: mod_perl vs velocigen
Message-Id: <f4a9a3fc.0311071023.1e3709a0@posting.google.com>

are they basically the same?  Is velocigen stable?  I went to their
website and i think they shut down?

Dan

I work at Universal Music Group in LA, if anyone wants a perl /java
job over there let me know.  danparker276@yahoo.com


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

Date: Fri, 07 Nov 2003 13:03:23 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: mod_perl vs velocigen
Message-Id: <HYRqb.1041$U87.32414@news.uswest.net>

Krusty wrote:
> are they basically the same?  Is velocigen stable?  I went to their
> website and i think they shut down?

Why not try a simple search on Google first?  You'll find much more 
information/discussions and you'll find it much quicker.



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

Date: 7 Nov 2003 18:43:14 GMT
From: Pedro Graca <hexkid@hotpop.com>
Subject: newbie 4th JaPH
Message-Id: <bogp42$1dqb28$1@ID-203069.news.uni-berlin.de>

How do you like this newbie's 4th JaPH attempt?

-- (not a .sig now)
#!/usr/bin/perl -w                 2003-11-07 Pedro Graca - JaPH4
@1=(2399670,250604053953,1455299,5114679918);foreach$2(@1){$s='';
while($2){$c=$2%49;$2=int($2/49);$s.=(chr(($c+64)^32))}push@p,$s}
print join(' ',@p),"\n"


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

Date: Fri, 07 Nov 2003 16:41:03 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: Perl features
Message-Id: <20031107114050.3d2a9202.jwillmore@remove.adelphia.net>

On Fri, 07 Nov 2003 01:37:17 -0500
Matt Oliverius <moliverius@w-link.net> wrote:
<snip>
> 
> 1) Perl is hard to understand and maintain (oh yeah, great reason to
> abandon a language, do we then abandon see because we have to worry
> about low level memory management?)

*Any* language can be hard to understand and maintain.

Understanding comes from *knowing* the syntax of the langauge and how
to make it work to your advantage.  English can be a hard to
understand langauge if you come from one of the romantic langauges -
because the snytax in English is different from, say, Spainish or
German.  So, this argument fails to prove anything.

Maintaining code is a task and a half for any langauge.  If you use
tools to aid in maintaining code (like CVS), then the task is easier. 
Again, the argument fails to prove anything. 

> 2) Perl is not object-oriented
> 
> I, along with about 100 others, flamed the heck out of this guy (who
> is a supposed Associate Technical Fellow).

One of Perl's shortcomings, IMHO, is the *need* for the programer to
make sure that OOP is enforced.  In other words, there's more you need
to code for in Perl versus langauges like C, C++, or Java.  However,
the facility is there to OOP in Perl.  Modules are an example of OOP
in Perl.

There are two books that cover OOP in Perl pretty well.  They are:
"Obeject Oriented Perl" (imagine that) by Damian Conway and "Learning
Perl Objects, References and Modules" by Randal Schwartz.  
Damian's book is, IMHO, a more in depth discussion designed for the
programmer that is coming from another language.  Randal's is a very
good and detailed "How-To" guide - desgined to get up up and running
if
you have more of a Perl background.  (Again, just my opinion).  Both
are excellent resources.

One last "rant" on this topic - Perl is the one of the only languages
that can easily provide what you need to extend your applications
*without* the need to recompile the base interpreter or jump through
hoops to get what you want.  You want to send email via SMTP, just
install the Net::SMTP module.  You want a GUI, install the Tk module. 

Languages like PHP have, for example, database support *compiled* as
part of the base language and the drivers need to be defined during
the install  in order to get them (RPM's and other pre-packaged ports
of the language solve this, but if you are using the "white knukled"
method of doing it by hand, well, you'll see what I mean).  Perl is
different - you just install the DBI module, then the appropriate DBD
module and you're off.  Change databases in mid-stream?  No problem. 
Just install another DBD and you're off.  This is rather simplistic,
but appears to be true for *most* business functions you code for
(meaning, *most* businesses want to send email, have GUI's, and
connect to databases).  There are *some* modules that shot this
statement right in the a**, but most are right on the mark.

<snip>

Granted, I have not mentioned Python.  However, IMHO, the above could
be applied to any comparison of Perl vs argument.

Of course, this all could lead to a "holy" type discussion ("My
language is better than your language" thread) :-)

-- 
Jim

Copyright notice: all code written by the author in this post is
 released under the GPL. http://www.gnu.org/licenses/gpl.txt 
for more information.

a fortune quote ...
Death is God's way of telling you not to be such a wise guy. 



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

Date: Fri, 07 Nov 2003 18:44:06 GMT
From: Dang Griffith <noemail@noemail4u.com>
Subject: Re: Perl features
Message-Id: <db0c5ad36d1af2aeb7e561a89afb42af@news.teranews.com>

On Fri, 07 Nov 2003 01:37:17 -0500, Matt Oliverius
<moliverius@w-link.net> wrote:

>I am a huge Perl fan.  However, after spending the last 4 years of my 
>career learning and developing Perl skills, my company is trying to ax 
>Perl. In a nutshell, the people that are supposed to be our company 
>experts, posted a bunch of false crap on a website that stated such false 
>statements as:
>
>1) Perl is hard to understand and maintain (oh yeah, great reason to 
>abandon a language, do we then abandon see because we have to worry about 
>low level memory management?)
>
>2) Perl is not object-oriented
>
>I, along with about 100 others, flamed the heck out of this guy (who is a 
>supposed Associate Technical Fellow).
>
>Anyway, he is giving bean-counter managers the impression that Python is 
>light years ahead of Perl and that Python should be used over Perl for any 
>new applications.  Does any know of any major shortcomings of Python that 
>Perl can handle?  I really want to beat on this guy a little.
I've been using Perl since 1988 or so.  I am a professional, trained,
etc programmer.  I have picked up Python in the last year or so.  The
languages are basically equivalent in their "ultimate capabilities".
Python does not enforce OOP any more than Perl.  In fact, that's one
of the strengths they share for scripts, oneoffs, etc.  

Both support Tk, and other GUIs; both have wonderful regular
expression support (they are more similar than different, and more
similar in their support than are Java, .Net, and others (see the
OReilly book if you think you know regex well)); both have a large
number of open source and commercial libraries available; both run on
more than three operating systems; both are older than Java and VB.

Having said that, Python syntactically resembles the pseudocode that
appears in many textbooks, and is, I believe, more readable to an
untrained person / non-programmer.  For that reason only, I have
started using Python more often than Perl in the last year.  I work
with several newbie programmers, and you know most people's knee-jerk
reaction to Perl syntax.  Frankly, I don't have the time or desire to
listen to them whine.

I agree with Tad--your argument should be based on fact, not religion.
I would also suggest it be based on experience, rather than hearsay.
So, why not go to http://www.python.org, download Python 2.3 and run
through the tutorial?  It wouldn't hurt.
      --dang
p.s.
Being a flamer rarely helps win a debate in the workplace.


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

Date: 7 Nov 2003 10:54:35 -0800
From: batman@thundermail.com (Brian Andrus)
Subject: searching for null in pattern
Message-Id: <ae9a7893.0311071054.47cac8af@posting.google.com>

I am trying to parse an html line that contains lots of noise. I have
gotten it down mostly, but am having trouble with exact matches.

The part  I am looking at will be
*align="right"><b>##.###</b></td>*

where * is much useless stuff and ##.### is the part I am trying to
extract.
The issue:

examples of what ##.### might be:
9.31
0.17
8.345
12.72

So I need to get something that will return the value whethere there
is 1 or 2 digits before the decimal and 2 or 3 digits after.

I have 

/^*align="right"><b>*([0-9]\.[0-9][0-9])/

which will work for #.##, but not the other possibilities. How do I
get all the possibilities in a single search? When I try using *
inside the parentheses, I get an error.

Brian Andrus


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

Date: Fri, 07 Nov 2003 18:44:21 GMT
From: Marc Dashevsky <m_arc@world.std.com>
Subject: Re: Tool to embed images (or other binaries)  in your Perl source.
Message-Id: <MPG.1a15b251aabb28ad9897b8@netnews.comcast.net>

bik.mido@tiscalinet.it says in article <nsdnqvogfpv9bn30okj51mk58jefpi39rd@4ax.com>:
> On Wed, 5 Nov 2003 17:06:20 -0700, "Michael Carey"
> <usenet@giantsquidmarks.com> wrote:
> 
> Seriously, and indeed OT wrt the subject of this thread, I find
> astonishing the difference that there's between the (sub-)cultures of
> comp.lang.perl.misc and comp.lang.perl.tk respectively.
> 
> Unfortunately I'm not able to report a proper review of this issue,
> but only cite a few examples: non-strict and/or non-warnings enabled
> scripts are much more tolerated, awkward ways to "do things" also, and
> so on.
> 
> Please, note that I'm *not* saying that "pTk programmers write crappy
> code", only that in CLPT while the attention is focused on GUI's logic
> and features much less care *seems* to be dedicated to the
> ("remaining") perl code itself.
> 
> But this involves also posting policies: a post like this one (the one
> I'm following-up to) containing no proper quotations and/or references
> usually generates a chorus of complaints in CLPM.

Look, I don't read clpm, so I really don't know what goes on there,
but I would say that the folks here generally try to help answer
the question being asked, and don't provide unsolicited help in
other areas, other than suggesting "use strict"!  While there may
be some opportunities lost to help people, I think that it results
in a newsgroup that is pretty pleasant and helpful.

-- 
  Marc Dashevsky -- Remove '_' from address if replying by e-mail.


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

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


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