[11930] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5530 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Apr 30 18:07:18 1999

Date: Fri, 30 Apr 99 15:00:25 -0700
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, 30 Apr 1999     Volume: 8 Number: 5530

Today's topics:
    Re: "learning perl" does not seem to be written well (David H. Adler)
    Re: Checkbox is not working. <cassell@mail.cor.epa.gov>
    Re: Concatenating files with PERL (Rat Pfink)
        copy file  <cpl11@netcom.ca>
        create directory with perl script? <cpl11@netcom.ca>
    Re: create directory with perl script? <design@raincloud-studios.com>
    Re: Dynamic loading perl modules (Garrett Casey)
        Executing Perl code within print structure... <design@raincloud-studios.com>
    Re: Global Filehandle ? <Wm.Blasius@ks.sel.alcatel.de>
    Re: Impythonating PERL? <cassell@mail.cor.epa.gov>
    Re: Instance Data / Instance Variables <cassell@mail.cor.epa.gov>
    Re: matching a quoted string (Tad McClellan)
    Re: newbie in need... <cassell@mail.cor.epa.gov>
    Re: Newsfeed and Local Weather <uri@sysarch.com>
    Re: NT Perl vs UNIX Perl (Charles DeRykus)
    Re: Perl on a 386 with 2 MB RAM??? <bowman@montana.com>
    Re: Perl on a 386 with 2 MB RAM??? (Bart Lateur)
        Perl web watching script exposuregraphics@hotmail.com
        RegExp for escape characters swistow@my-dejanews.com
    Re: Regexp help needed <cassell@mail.cor.epa.gov>
    Re: Simple Checksum "Confidence Level"?? <sb@sdm.de>
    Re: Simple Checksum "Confidence Level"?? <sb@sdm.de>
    Re: Using a reference to an array <nospam_earnold@requisite.com>
    Re: Using a reference to an array <uri@sysarch.com>
    Re: using perl to manage passwords? (Tad McClellan)
    Re: using perl to manage passwords? (Tad McClellan)
    Re: what's wrong with $x = $y or "" <cassell@mail.cor.epa.gov>
    Re: why /g gets me wrong search results? (Ilya Zakharevich)
        Win32 GUI + embedded Perl? <benles@powernet.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: 30 Apr 1999 17:49:13 -0400
From: dha@panix.com (David H. Adler)
Subject: Re: "learning perl" does not seem to be written well
Message-Id: <slrn7ik9ao.6fg.dha@panix.com>

On Thu, 29 Apr 1999 19:47:29 GMT, birgitt@my-dejanews.com
<birgitt@my-dejanews.com> wrote:

>All nice and good, but the basic problem is that even Larry Wall pointed
>out that Perl should not be used as the first programming language to learn.

I don't remember ever seeing that.  The closest I'm aware of is:

"Perl should only be studied as a second language.  A good first
language would be English."

 ....which doesn't address the question of a first *programming*
language.  In fact, to me, it implies quite the opposite of your
comment.  I'd be interested to see your source.

>Therefore a Perl book which addresses the non-programmer has not been written
>yet, AFAIK.

This, however is *quite* true.

dha

-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Hey, Siegfried!  Pick an accent and stick with it!
	- Tom Servo, MST3K


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

Date: Fri, 30 Apr 1999 13:50:50 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Checkbox is not working.
Message-Id: <372A17AA.998E8412@mail.cor.epa.gov>

jeffrey_f@my-dejanews.com wrote:
> 
> I have a script which saves data..and keeps it in hidden fields.  Basically,
> you press next, and puts data into hidden fields.
> 
> The problem is it only saves the last checkbox (last field in the HTML).   I
> can figure out why!!   Happens with any checkboxes...name doesnt matter, value
> doesnt...weird.

Now that you've been sufficiently mocked, perhaps you realize what 
the problem is.  This is a CGI problem decked out in a llama's coat.
I.e., this is not an appropriate question for this newsgroup, since 
here we do Perl programming.  Even if some of your code is in Perl,
that doesn't make this a Perl problem.  You might get a much more
helpful response from the kind folks at 
   comp.infosystems.www.authoring.cgi
But if you choose to psot there, please give a more helpful message 
than this one.  Show them the code that doesn't work, any server logs
with appropriate information, any errors you get, and what the output 
was supposed to be.  This might help someone without psychic powers
figure out what your problem is.

> Thanks Alot.

You're Welcome A Ton,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Fri, 30 Apr 1999 21:04:24 GMT
From: ratpfink@akamail.com (Rat Pfink)
Subject: Re: Concatenating files with PERL
Message-Id: <372d19bc.88700663@news.earthlink.net>

Same thing can be done on NT with:

c:>copy /b f1 f2 f3 > f4

It's just that nobody that uses NT/95/98 these days knows
their way around a command prompt...

On 30 Apr 1999 12:54:14 -0700, Tom Christiansen <tchrist@mox.perl.com>
wrote:
>
>Man, it sure sucks to be screwed out of proper tools, doesn't it?
>
>    % cat f1 f2 f3 > f4
>




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

Date: Fri, 30 Apr 1999 17:22:20 -0400
From: cpl11 <cpl11@netcom.ca>
Subject: copy file 
Message-Id: <372A1F0B.AC54B2A9@netcom.ca>

Dear Friends
I also look for a command which enable perl script to copyone file to
another directory
Thank you for help me out
Andrea



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

Date: Fri, 30 Apr 1999 17:08:13 -0400
From: cpl11 <cpl11@netcom.ca>
Subject: create directory with perl script?
Message-Id: <372A1BBC.F1B0FDA9@netcom.ca>

dear netter friends
How to use perl script to creat a directory
please help
Thank yu
Andrea



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

Date: Fri, 30 Apr 1999 21:28:48 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Re: create directory with perl script?
Message-Id: <kgpW2.68$iu1.175@news.rdc1.tn.home.com>


cpl11 wrote in message <372A1BBC.F1B0FDA9@netcom.ca>...
>dear netter friends
>How to use perl script to creat a directory
>please help
>Thank yu
>Andrea


mkdir("/mydir/", 0550);

Same as UNIX, sorta. :)

CT






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

Date: Thu, 29 Apr 1999 20:08:32 GMT
From: remove_this_prefix_adms1@cts.com (Garrett Casey)
Subject: Re: Dynamic loading perl modules
Message-Id: <3728ba6e.958571893@nntp.cts.com>

Check out the Perl Cookbook pages 397-398

require Mymodule; is a run-time load;

So, 

require "$user_selected_module";

You may have to implicitly call the modules import function (if there
is any stuff that is normall imported into the main namespace)

Mymodule->import();

So basically, check out "require" and the Exporter module (for the
import function).



On 30 Apr 1999 17:17:35 GMT, "Vasco Patrmcio" <vpatricio@abrantina.pt>
wrote:

>To anyone who is kind enough to answer:
>
>I'm building a web application that has a main service that provides access
>to several distinct services. Each service is coded in a separate perl
>module (a .pm file). Right now, I had to include all the modules in the
>main service (via "use").
>
>I think there must be a way of loading only the module that the user asks
>for. I searched the Camel book and only found documentation about
>DynaLoader, which, if I understood correctly, only loads previously
>compiled libraries.
>
>My question is:
>
>How do I load a perl module dynamically? Do I have to compile it first?
>
>Thanks,
>Vasco

-Garrett Casey


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

Date: Fri, 30 Apr 1999 20:57:25 GMT
From: "Charles R. Thompson" <design@raincloud-studios.com>
Subject: Executing Perl code within print structure...
Message-Id: <VOoW2.67$iu1.158@news.rdc1.tn.home.com>

Okay.. I forget what they call this type of print structure...

print <<END_OF_HTML;
La la la
END_OF_HTML

Anyway... I'm experimenting with a script that accepts HTML
markup in a Textfield, then builds a small Perl-type library on
the system. The HTML then becomes part of a larger script.

I'm trying to wrap my brain around all the things that could go
wrong as far as security is concerned... I realize it's probably
wide open.

I can't seem to call any subroutines or system commands from
within the print statement, which leads me to believe it's
pretty safe. The only thing I could come up with was if someone
typed...

END_OF_HTML

terrifying system code here...

print <<END_OF_HTML;

into the textfield... which I can check for and it eliminates
the problem.

Is there anything I'm unaware of that could really be fatal
here? I'm sure there are some really clever tricks coming my
way. Should I just ban the use of anything but <> </> and
standard A-Z 0-9 ?

Thanks,

CT




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

Date: Fri, 30 Apr 1999 22:07:44 +0200
From: William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Global Filehandle ?
Message-Id: <372A0D90.446B9B3D@ks.sel.alcatel.de>

[a courtesy copy of this posting was sent to the cited author by email]
Tom Christiansen elucidated:
>  
> In comp.lang.perl.misc,
>     William Blasius #42722 <Wm.Blasius@ks.sel.alcatel.de> writes:
> :What I see in %main:: after the open *looks* the same as the entries
> :for STDOUT and STDERR but must somehow be different.
> 
> That's right.  STD{IN,OUT,ERR} when unqualified default to package main,
> as do ARGV and ARGVOUT.  Other filehandle when unqualified default to the
> current package.  Just don't not qualify them.  Better yet, go through
> a mediating function, one which "owns" that handle.
> 
> --tom
That sounds almost like the choice between grotty one and grotty two. In
my particular case, I can get away with the second - and did - but where
can I get the straight dope on user-defined variables with global scope?
This is the first time I've needed one in quite a while but at least one
inquiring mind wants to know. Okay, maybe not enough to reverse-engineer
the perl interpreter, but curiosity is the work the devil finds for idle
minds.
>
Thanks for the help.

Wm
--


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

Date: Fri, 30 Apr 1999 14:25:58 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Impythonating PERL?
Message-Id: <372A1FE6.A21E3E07@mail.cor.epa.gov>

Avery Andrews wrote:
> 
> In <37288D73.B52B4E8F@mail.cor.epa.gov> David Cassell
> <cassell@mail.cor.epa.gov> writes:
> > [a bunch of drivel, as usual :-]
>
> That makes sense, so perhaps a better version of the idea would be as
> a whitespace-driven syntax checker, no too hard to derive from Damian
> Conways code.

Perhaps...  But I wouldn't dream of trying to write a syntax-checker 
that would be better than this already available one:

perl -wc yourfilename.pl

:-)
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Fri, 30 Apr 1999 14:45:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Instance Data / Instance Variables
Message-Id: <372A2483.3954A792@mail.cor.epa.gov>

Tom Christiansen wrote:
> 
> [some useful if acerbic advice]
>
> I suggest reading the documentation referenced about, and if that
> fails, please look into the examples from Chapter 13 from the Perl Cookbok.
> You can fetch that code here:
> 
>     ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/

Let me just add that you might want to *buy* the Perl Cookbook,
because the discussions in that chapter might help you more than the 
code examples.  The O'Reilly site has only the code.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: Fri, 30 Apr 1999 12:18:50 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: matching a quoted string
Message-Id: <a5lcg7.1l.ln@magna.metronet.com>

Ala Qumsieh (aqumsieh@matrox.com) wrote:

: 	$line =~ s/$compare/$newstr/eg;

: This is faster since you don't need to match $compare twice. Also,
: if $newstr is a simple scalar, then you can drop the /e modifier.


   I would like to know _any_ value for $newstr that disallows
   removing that /e modifier.

   The /e just replaces the variable name with its value.

   bare s///; also just replaces the variable name with its 
   value (interpolation in double quotish context).


   If $newstr contained perl code that returned the string to
   use as the replacement value, then you would need s///ee.
   
   One e to replace the name with the value, a second e to
   eval the value.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Apr 1999 14:54:34 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: newbie in need...
Message-Id: <372A269A.5B220A64@mail.cor.epa.gov>

Philip 'Yes, that's my address' Newton wrote:
> 
> Stephen Warren wrote:
> >
> > cl.exe is a C compiler. Certainly, Microsoft c provides cl.exe - I
> > don't know what other vendors name their executable.
> 
> ObTrivia: I believe 'cl' stands for '_C_ompiler and _L_inker driver',
> since cl.exe invokes other programs with funny names such as c1xx.exe
> and link.exe etc. which do the actual dirty work.
> 
> Borland calls their C compiler tcc or bcc. FWIW.

And I think there's some wacky gcc thing I've heard of somewhere.  :-)
Not everyone except M$ calls it cc.

David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 30 Apr 1999 16:17:59 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Newsfeed and Local Weather
Message-Id: <x790b97thk.fsf@home.sysarch.com>

>>>>> "TC" == Tom Christiansen <tchrist@mox.perl.com> writes:


tom,

it is nice that you posted a complete working program, but have you
looked at the actual code? it is pretty abysmal. since it was written in
1991, it doesn't use any modules which would reduce its size and
complexity. here are some of the more obvious failings:

  TC> %canNames = ("salt","1",  "SALT","1",
  TC> 	     "calt","2",  "CALT","2",
  TC> 	     "nalt","3",  "NALT","3", "nebc","3", "NEBC","3",

  TC> if ($t=$canNames{$CITY}) {
  TC>     $CITY = $t;
  TC> }

just lc $CITY and eliminate all the dup upper/lower city names in the hash

  TC> $here  = pack($sockaddr,2,0,&getaddress("localhost"));
  TC> $there = pack($sockaddr,2,$PORT,&getaddress($SERVER));

looks like hardcoding of socket constants here. even you would eschew
that!

  TC> while (read(SOCK,$c,1)) {	# Get a character

reading a char at a time? that is so c like!

  TC> 	    printf SOCK "\n";	# For Canadian forecast, go via main menu

printf with no format string!! so c like!
someone tell the author about print. this error is common in the code.

  TC> 	    printf SOCK "%s\n", $CITY; # For US, bypass menu

oh, here is a printf with a format! please tell him about interpolation!!

  TC>     } elsif ($curline =~ / Invalid city or state code./) {
  TC> 	printf SOCK "X\n";
  TC> 	printf "%s is an invalid city or state code.\n", $CITY;
  TC> 	&showitoff("invalid");
  TC>     } elsif ($curline =~ / CITY FORECAST MENU/) {
  TC> 	&showitoff("city forecast");
  TC>     } elsif ($curline =~ / CURRENT WEATHER MENU/) {
  TC> 	&showitoff("city forecast");
  TC>     } elsif ($curline =~ / CANADIAN FORECASTS/) {
  TC> 	&showitoff("canadian forecasts");
  TC>     } elsif ($curline =~ / Press Return for menu: /) {

this large if/else should be simplified with a loop on the possible
strings and args.

  TC>     @ary = gethostbyname($host);
  TC>     return(unpack("C4",$ary[4]));

use gethostbyname in scalar context

  TC> }

  TC> sub showitoff {
  TC>     local($txt) = @_;

my is better than local.


  TC>     # These next few lines are legal in both Perl and nroff.

nroff!! nroff embedded in the perl source!!! puleaasee!! use pod and
pod2man


thanx tom, that was educational on how not to write a weather server
program!

uri

-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 30 Apr 1999 20:57:26 GMT
From: ced@bcstec.ca.boeing.com (Charles DeRykus)
Subject: Re: NT Perl vs UNIX Perl
Message-Id: <FB0svq.5wB@news.boeing.com>

In article <FB0GCJ.8pv@news.boeing.com>,
news.boeing.com <jim.ray@west.boeing.com> wrote:
>I am getting better with converting my UNIX perl to NT, but still some
>problems exist.  It's not as easy some would say.
>
>Is there some documentations that describe what calls different from NY and
>UNIX?
>
>Such commands like CHDIR in UNIX does not work with NT.  Well at least it
>does not work with my code.

`chdir' works with NT. Did you look at the online docs... 


example:

  chdir '/some/directory' or die "can't chdir: $!"  


Here's a dated list of unsupported features but maybe
someone can point out something more current:


hth,
--
Charles DeRykus


FYI: Following are the unsupported functions of ActiveState Port build 3.16:

Unsupported network routines
============================
getnetbyname()
getnetbyaddr()
getnetent()
getprotoent()
getservent()
sethostent()
setnetent()
setprotoent()
setservent()
endhostent()
endnetent()
endprotoent()

Unsupported System V compatible IPC routines
============================================
msgctl()
msgget()
msgrcv()
msgsnd()
semctl()
semget()
semop()
shmctl()
shmget()
shmread()
shmwrite()


Unsupported I/O routines
========================

ioctl()**

Unsupported filesystem routines
===============================
chroot()
fcntl()**
link()
lstat()**
readlink()**
symlink()
umask()**


Unsupported security-related routines
=====================================
getpgrp()
getppid()
getpriority()
getpwnam()
getgrnam()
getpwuid()
getgrgid()
getpwent()
getgrent()
setpwent()
setgrent()
endpwent()
endgrent()
setpgrp()


Unsupported process-related routines
====================================
fork()
setpriority()
times()
wait()
waitpid()


Unsupported miscellaneous routines
==================================
alarm()
dump()**
syscall()



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

Date: Fri, 30 Apr 1999 14:07:10 -0600
From: "bowman" <bowman@montana.com>
Subject: Re: Perl on a 386 with 2 MB RAM???
Message-Id: <u4oW2.1065$3h1.6266@newsfeed.slurp.net>


Ronald van der Lingen <166959rl@student.eur.nl> wrote in message
news:7gclr9$eho$1@news.casema.net...
> Yes I use MS-DOS. I have found a port of Perl 4 that works on my laptop. I
> tried two different port of Perl 5, but they didn't work. But thanks. I
can
> now enjoy the sunshine and learn to program Perl at the same time! :-)

you may want to look at www.delorie.com

djgpp is a DOS port of the gnu toolchain, and Perl5 has been ported to it.
It should run on your system, though you may need the dpmi package too, if
you don't have one.





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

Date: Fri, 30 Apr 1999 21:19:24 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl on a 386 with 2 MB RAM???
Message-Id: <372a1c9e.730063@news.skynet.be>

Ronald van der Lingen wrote:

>hello I want to install a perl interpreter on a 386 laptop with 2 MB RAM. Is
>there a port that I can use on this system?

bowman wrote:

>you may want to look at www.delorie.com
>
>djgpp is a DOS port of the gnu toolchain, and Perl5 has been ported to it.
>It should run on your system, though you may need the dpmi package too, if
>you don't have one.

Maybe it WON'T run. Who knows, without testing. Anyway, here's the
minimum requirements for DJGPP tools, from the DJGPP FAQ:

For the GCC compiler, from:
	http://www.delorie.com/djgpp/v2faq/faq004.html#Minimum

>DJGPP requires at least 386SX CPU
>A minimum of 64K of free system memory is enough for DJGPP to run with
>CWSDPMI as your DPMI host (most other DPMI hosts will require much
>more), but at least 4MB of free extended RAM is recommended for
>reasonably fast compilation of large source files

And from
	http://www.delorie.com/djgpp/v2faq/faq012.html#Config

> Q: How do I configure my system to get optimal performance under DJGPP? 

>A: That depends on the amount of RAM you have installed in your machine.

>   1.If you have 2 MBytes or less RAM installed: 
>          * Don't use any memory manager. 
>          * Use of CWSDPMI as your DPMI host is highly recommended. 

Well, it might just work.

	Bart.


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

Date: Fri, 30 Apr 1999 21:16:41 GMT
From: exposuregraphics@hotmail.com
Subject: Perl web watching script
Message-Id: <7gd6jm$fsp$1@nnrp1.dejanews.com>

Hello,

I have been trying to find a script out there and am so far having minimal
success. I am looking for a perl script which will automatically take a URL
list and check those web sites to see if they have been updated. I am sure
there is something like that out and about but the only script I have found is
somewhat spartan and cumbersome.

Any assitance or advice would be appreciated.

Rob

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 30 Apr 1999 19:45:40 GMT
From: swistow@my-dejanews.com
Subject: RegExp for escape characters
Message-Id: <7gd193$b8t$1@nnrp1.dejanews.com>

At the moment I'm writing a script which is a file line by ine.

Each line can contain a sequence along the lines of

${foo}

where 'foo' is a variable name, the value of which is obtained by the function

get_value('foo');

If get_value does return a result, say 'bar', then the whole sequence is to be
replaced by it

${foo} => 'bar'

however if get_value('foo') does not return a result then

${'foo'} => ${'foo'}

these sequences can occur any number of times on a line.

Implementing this wasn't too much of a problem using this (ugly) bit of code
 ...

  # let's check to see if there are any variables
  while ($value =~ m/\${([\w\d%]+)}/gi)
  {
	# there are! let's get it's real value
	my $replacer = get_value($1);
	# if it has one, then substitute it and carry on
	if ($replacer){
        	$value =~ s/\${$1}/$replacer/g;}
  }



However I want to increase functionality by allowing escape characters such
that

${foo}    => bar
\${foo}   => ${foo}
\\${foo}  => \bar
\\\${foo} => \${foo}

and any arbitary '\'s not followed by ${foo} will remain the same

\\\ some stuff ${foo} => \\\ some stuff bar

I've been trying for a couple of days to get this right and haven't come up
with anything that works properly (sometimes I get it correctly replacing the
slashes sometimes the variable but never both at the same time or if it does
it goes into an infinite loop even using \G).

Please help, this is driving me insane! And I've just ordered 'Mastering
Regexps' from Amazon so hopefully this should be the last time.

Simon Wistow

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Fri, 30 Apr 1999 14:30:40 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Regexp help needed
Message-Id: <372A2100.F9BFFDB8@mail.cor.epa.gov>

Sean wrote:
> 
> Hi,
>         I've got a real quick question.  What is the correct regular expression
> for matching ever character from the beginning of a string up to a
> comma?  I'm using  /^.*,/ right now which matches the entire line which
> is not what I want.  Any help is greatly appreciated.  ThanX!!!

THis won't match the whole line, unless the line ends with a comma
too.  This matches everything from the start of the line to the *last*
comma.  That's why they're called `greedy' matches.  In Perl, this is
simple:

/^.*?,/

You might want to read through the perlre manpage to learn more 
cool things you nca (and can't) do with Perl's version of regexen.

HTH,
David
-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 30 Apr 1999 20:00:23 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Simple Checksum "Confidence Level"??
Message-Id: <7gd24n$bh0$1@solti3.sdm.de>

In article <xkfbtg5nbm5.fsf@valdemar.col.hp.com>,
Eric The Read <emschwar@rmi.net> wrote:

> jabarone@my-dejanews.com writes:
> > I was wondering if anyone may have any ideas concerning some research I need
> > to do about a simple checksum routine to verify the programming of an 8 Meg
> > FLASH memory on a CPU module I'm working on.

> Probably.  But you should ask your question in a more appropriate venue.
> I would suggest alt.gaping.chest.wounds; they surely would know at least
> as much (if not more) about checksum confidence levels than a newsgroup
> about Perl, the programming language.

> > I was asked to come up with a "confidence level", in so many percent, that a
> > simple 32-bit checksum (i.e., the addition of all the words in a FLASH memory
> > (firmware)) would verify the image was correct.

> My personal scientific opinion is "pretty pathetically poor", but I
> have made no effort to check the literature.  Apparently you haven't
> either.

Well, the thing is quite simple: You have 8 MB of RAM, that is
8 * 1024 * 8 bits.

Now find out how many of the possible values a word of 8*1024*8 bits can
assume will lead to exactly the same (32 bit) checksum. Call this number "n".
Now you have a chance of 1 in "n", i.e., 1/n, that your correct checksum
reflects the expected correct contents of your memory bank.

Hint: n is probably equal to 2^8*1024*8/2^32 regardless of your checksum
algorithm, unless your algorithm is degenerated in some way (e.g., always
returns the same value regardless of its input).

In other words, 1/n = 2^32/2^8*1024*8 = 2 ^ (32 - 8*1024*8)

Which is pretty small...

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: 30 Apr 1999 20:16:26 GMT
From: Steffen Beyer <sb@sdm.de>
Subject: Re: Simple Checksum "Confidence Level"??
Message-Id: <7gd32q$bn1$1@solti3.sdm.de>

> jabarone@my-dejanews.com writes:

> I was wondering if anyone may have any ideas concerning some research I need
> to do about a simple checksum routine to verify the programming of an 8 Meg
> FLASH memory on a CPU module I'm working on.

> I was asked to come up with a "confidence level", in so many percent, that a
> simple 32-bit checksum (i.e., the addition of all the words in a FLASH memory
> (firmware)) would verify the image was correct.

I wrote:

> Well, the thing is quite simple: You have 8 MB of RAM, that is
> 8 * 1024 * 8 bits.

> Now find out how many of the possible values a word of 8*1024*8 bits can
> assume will lead to exactly the same (32 bit) checksum. Call this number "n".
> Now you have a chance of 1 in "n", i.e., 1/n, that your correct checksum
> reflects the expected correct contents of your memory bank.

> Hint: n is probably equal to 2^8*1024*8/2^32 regardless of your checksum
> algorithm, unless your algorithm is degenerated in some way (e.g., always
> returns the same value regardless of its input).

> In other words, 1/n = 2^32/2^8*1024*8 = 2 ^ (32 - 8*1024*8)

> Which is pretty small...

Actually this is not the complete truth, because this assumes that the
contents of the flash ROM are random.

But since your burning of the ROM tries to burn a specific pattern, you
need to assign probabilities to 0, 1, 2, 3, 4, ... bits being wrong after
the burn.

Then it depends on your algorithm wether it will assign different checksums
to patterns which differ in this number of bits.

If it does so for hamming distances till "m", then the probability of a
false positive should be

SUM (P({i wrong bits}) * P({same CHKSUM despite i wrong bits}))

for i = m+1 to 8*1024*8 (all bits wrong).

Rather tricky computation. Looks like at least a doctoral thesis to me... :-)

Yours,
-- 
    Steffen Beyer <sb@engelschall.com>
    http://www.engelschall.com/u/sb/whoami/
    http://www.engelschall.com/u/sb/download/
    http://www.perl.com/CPAN/authors/id/STBEY/
    http://www.oreilly.de/catalog/perlmodger/bnp/


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

Date: Fri, 30 Apr 1999 14:26:54 -0600
From: "Eric Arnold" <nospam_earnold@requisite.com>
Subject: Re: Using a reference to an array
Message-Id: <7gd3l3$5ba$1@news1.rmi.net>

The answer is to add brackets:  $#{@$xreference}

though you might do a service to posterity and split it out for readability:

@somearr = @$xreference;
 .
 .
$last_elem = $somearr[ $#somearr ];

Instead of

$last_elem = $xreference->[ $#{@$xreference} ];

Keep in mind this doesn't give you the size, but the index of the last
element, which is
size - 1.  So you might want:

$len = scalar( @$xreference );

Daniel wrote in message <7gadju$heh$1@nntpd.lkg.dec.com>...
>
>Given
>
>my @xarray = qw( A B C D E );
>my $xreference = \@xarray;
>
>How can I find the size of the array referenced
>by $xreference?
>
>Using ' $#@$xreference ' causes the compiler
>to grumble.
>
>-Daniel
>
>




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

Date: 30 Apr 1999 16:48:55 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Using a reference to an array
Message-Id: <x73e1h7s20.fsf@home.sysarch.com>

>>>>> "EA" == Eric Arnold <nospam_earnold@requisite.com> writes:

  EA> The answer is to add brackets:  $#{@$xreference}

normally called braces or curlies or curly brackets. plain brackets are []
(also called square brackets)

  EA> @somearr = @$xreference;
  EA> .
  EA> .
  EA> $last_elem = $somearr[ $#somearr ];

or $somearr[ -1 ];

  EA> $len = scalar( @$xreference );

warning! warning! redundant use of scalar in scalar context.
warning! warning! redundant use of scalar in scalar context.

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
uri@sysarch.com  ---------------------------  Perl, Internet, UNIX Consulting
Have Perl, Will Travel  -----------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Fri, 30 Apr 1999 11:52:10 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: using perl to manage passwords?
Message-Id: <ajjcg7.cj.ln@magna.metronet.com>

Dan Baker (dtbaker@bus-prod.com) wrote:
: I need to implement some password protected areas of a website... can

: I'm sure the group would all learn a lot!


   I'm sure many in the group would not want to see how to do
   that because they do not care about the WWW.

   This is the Perl newsgroup. We talk about Perl type stuff here.

   Perl is not equivalent to the WWW.

   In fact, most Perl programming has nothing to do with the WWW.



   WWW type stuff is discussed in the comp.infosystems.www.*
   newsgroups.

   Please do not have a WWW discussion in the Perl newsgroup,
   have it in a WWW newsgroup.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Apr 1999 12:09:40 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: using perl to manage passwords?
Message-Id: <4kkcg7.1l.ln@magna.metronet.com>

Dan Baker (dtbaker@bus-prod.com) wrote:
: I need to implement some password protected areas of a website... can
: anyone suggest some online tutorials on the subject? I am looking for
: information on what is possible, how secure it will be, whether robots
: would be able to "get in" to subdirectories. etc.

: If you have experience in this area, and can explain the basic options
: and pros/cons of each, I'm sure the group would all learn a lot! Just a
: basic overview would help.

: If anyone can post links, examples, or suggest good reading....


   Please do not post identical articles individually to
   multiple newsgroups.

   Crosspost instead so that tens of thousands of computers around
   the world will not have to store multiple copies of the same
   thing.

   Being wasteful of other people's resources reveals a selfish
   nature to thousands of people...



   Changing the subject so that in includes "perl" does not
   transform your question into a Perl question BTW.


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Fri, 30 Apr 1999 14:19:35 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: what's wrong with $x = $y or ""
Message-Id: <372A1E67.BDAD85CF@mail.cor.epa.gov>

Rick Delaney wrote:
> 
> [posted & mailed]
> 
> Philip 'Yes, that's my address' Newton wrote:
> >
> > Ronald J Kimball wrote:
> > >
> > > Why couldn't it be called ?? ?
> >
> > Conflict with the ?...? one-time pattern match operator?
> 
> What conflict?  Do you have an example of a statement with ?? that would
> make the meaning of the operator ambiguous?

I assumed the conflict there was with the `use sarcasm;' pragma.

-- 
David Cassell, OAO                            cassell@mail.cor.epa.gov
Senior Computing Specialist                      phone: (541) 754-4468
mathematical statistician                          fax: (541) 754-4716


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

Date: 30 Apr 1999 21:11:06 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: why /g gets me wrong search results?
Message-Id: <7gd69a$4p0$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to H.C. Chen
<hcchen@pobox.com>],
who wrote in article <925443985.15408@proxy2.acer.net>:
> Problem shown as below simple program and results,
> Run:  perl defect.pl data
> Get different results for /i switch (correct) and
> /ig switch (wrong), I'd like to know why? Thank you
> in advance.

> === defect.pl ========
> #!perl -wn
> print if m/defect/ig;
> ======================
> 
>  Data          m/defect/i;    m/defect/ig;
> ------------  -------------  --------------
>  Defect 01     Defect 01       Defect 01
>  defect 02     defect 02       defEct 03
>  defEct 03     defEct 03       defEct 05

You should have upgraded a couple of years ago.

Ilya



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

Date: Fri, 30 Apr 1999 14:46:44 -0700
From: Ben & Leslie Allfree <benles@powernet.net>
Subject: Win32 GUI + embedded Perl?
Message-Id: <372A24C4.81F4029E@powernet.net>

Hi,

    Has anyone successfully embedded Perl 5.005.03 into a C Win32 GUI
program (i.e., not a console app)? I'm using the source distribution and
egcs 1.1.2 as my compiler. I'm using the standard C embed interface and
not ActiveWare's PERL_OBJECT interface.

    I'd really appreciate any help! I've successfully compiled GraphApp
(a C GUI interface) and embedded Perl into a console app, now I want to
combine the two!

Thanks,
    Ben

--
Ben & Leslie Allfree
B & L Digital Publishing
www.bldigital.com
benles@bldigital.com




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

Date: 12 Dec 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Special: Digest Administrivia (Last modified: 12 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 5530
**************************************

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