[16891] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4303 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 12 18:20:47 2000

Date: Tue, 12 Sep 2000 15:20:33 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <968797232-v9-i4303@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Tue, 12 Sep 2000     Volume: 9 Number: 4303

Today's topics:
    Re: Qualifications for new Perl programmer????? (Eric Bohlman)
    Re: Qualifications for new Perl programmer????? <mischief@motion.net>
    Re: Qualifications for new Perl programmer????? <nospam@david-steuber.com>
    Re: Qualifications for new Perl programmer????? <elephant@squirrelgroup.com>
    Re: Qualifications for new Perl programmer????? <godzilla@stomp.stomp.tokyo>
    Re: Qualifications for new Perl programmer????? <elephant@squirrelgroup.com>
        Reading piped input on Windows NT charlie.bursell@healthcare.com
    Re: Reading piped input on Windows NT <bcaligari@my-deja.com>
    Re: Reading piped input on Windows NT (Malcolm Dew-Jones)
    Re: RFOL: zap dupes, preserve order (Chris Fedde)
    Re: Running external programs and grabbing the output <nothing here! complain about that!!!>
        Startup error at Perl/Tk? <meisl@amvt.tu-graz.ac.at>
    Re: Startup error at Perl/Tk? <yanick@babyl.sympatico.ca>
        Test Your Perl Skills cd_root@my-deja.com
    Re: Test Your Perl Skills <uri@sysarch.com>
    Re: This *should* be easy, string parsing question <tim@ipac.caltech.edu>
    Re: This *should* be easy, string parsing question <spragg@cs.ucdavis.edu>
        Where Doesn't this work? <brian@ukdj.freeserve.co.uk>
    Re: Where Doesn't this work? <All@n.Due.net>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: 12 Sep 2000 18:31:32 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <8plsq4$get$3@slb3.atl.mindspring.net>

Ilmari Karonen (iltzu@sci.invalid) wrote:
: I could answer each of your questions, but I would've - like you later
: told some of your candidates did - complained about you disallowing
: the use of reference material.  The knowledge that interpolated arrays
: are joined by $" while the arguments to print() are joined by $, isn't
: really doing anything for me except taking up space in my mind.  All I
: _need_ to know is that the answer is in perlvar(1).

I agree here, with the proviso that while knowing the precise names of 
the two variables isn't a useful "qualification," knowing that both cases 
*are* under the control of special variables, and that a different 
special variable is involved in each case *is* useful knowledge and is 
probably worth testing.  If you understand the concepts, you can always 
look up the exact names in perlvar.  But if you don't understand the 
concepts, it may not even occur to you to check perlvar, and even if it 
does occur to you, all you'll be able to do is read through the whole 
thing trying to find those variables.



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

Date: Tue, 12 Sep 2000 13:34:33 -0500
From: "Chris Stith" <mischief@motion.net>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <srstn38oct615@corp.supernews.com>

"Eric Bohlman" <ebohlman@netcom.com> wrote in message
news:8pi27p$kk7$9@slb1.atl.mindspring.net...
> Christopher M. Jones (christopher_j@uswest.net) wrote:
> : Oooo, ouch that's harsh.  I guess that's why a lot of job
> : postings have fairly unreasonably high required skill levels
> : (for that pay anyway), to try to weed out the wannabes.  I

[snip]

> True, but there are a couple other reasons for pumped-up skill levels.
> In the US, if you see a job ad that requires a bunch of seemingly
> unrelated skills, a likely reason is that the firm already has a
> specific candidate in mind, but the candidate is a foreign national and
> can't obtain a work visa unless his potential employer demonstrates
> to the immigration authorities that they can't find a US citizen who's
> qualified for the position.  The result is that the firm defines the
> qualifications in terms of the candidate's specific experience and then
> places an ad, knowing full well that they're unlikely to find anybody.
>
> Another reason is that the job description may have been written by an HR
> type who doesn't really understand the skill-set involved and just
> reaches for a bunch of buzzwords.

[snip]

Another reason is that the job is being offered to the public only because
it has to be, but that the person doing the hiring wants to make the
official description fit a particular person's c.v. so that that person will
be easily justified as a potential hire for the job. Perhaps not
surprisingly, I've seen this done within governmental bodies. They want a
certain person. They're afraid someone else might apply who's more
qualified. They doctor the help wanted ad to include as few people other
than their favorite. After all, "in the sense of fairness", the law states
the job must be offered publicly.

Yet another, much more innocent, reason to list a bunch of seemingly
unrelated qualifications is that the company doing the hiring is a small
firm who can't afford a bunch of specialists in a bunch of differing fields
but who had a former employee who was multi-talented. If one person wore
several hats before leaving, the company could have come to depend on one
person doing all those things. If this is the case, the former employee
probably left for higher pay somewhere else ;)

Chris Stith
mischief@pikenet.net  mischief@motion.net
There's no time like one fondly remembered.





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

Date: Tue, 12 Sep 2000 19:19:55 GMT
From: David Steuber <nospam@david-steuber.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <m3vgw1to2t.fsf@solo.david-steuber.com>

"Godzilla!" <godzilla@stomp.stomp.tokyo> writes:

' Employment Qualifications -
' 
' Write an imaginative and creative Perl script with a minimum
' of five-hundred lines which produces results which will give
' me a smile, make me laugh or simply amaze me. This script 
' must bend, break, twist, mutilate and violate every Perl 
' rule possible, yet run with lightning fast perfection. It
' must be written Perl 4 style and not use pragma hints nor
' any modules. Scoring will be by how surprised I am.

Well, I guess I'll never work for you.  I use Perl 5.6, strict and any
modules that are useful to me to get the job done with a reasonable
LOC and time invested.

Execution time does not seem to be a problem.

-- 
David Steuber | "Are you now, or have you ever been, a member
NRA Member    | of the NRA?" --- HUAC, 2004

Happiness is a SAAB Gripen <http://www.gripen.saab.se/> in the
garage, an FN-FAL in the safe, and an HK P7M8 on the hip.


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

Date: Wed, 13 Sep 2000 07:31:26 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <MPG.14292f9e9342de2d98978b@localhost>

Steven Merritt <smerr612@mailandnews.com> wrote ..
>In article <MPG.1426fd79598c517b989773@localhost>,
>  jason <elephant@squirrelgroup.com> wrote:
>
>> I'm not a big believer in 'qualifications' in the conventional sense
>> of the word .. but I did ask that everyone complete the following
>> quick quiz .. I sprung it on the candidates and they had to complete
>> it without referring to any references
>>
>> regulars in this group will be saddened to learn that out of 9
>> unsuccessful candidates I received just three correct answers in
>> total (not three correct quizzes .. but three correct answers) .. and
>> that was despite the fact that I basically gave away all the builtin
>> variable related answers in the wording of the question
>
>I didn't have trouble with your quiz, even though you did some naughty
>things like array names made up of punctuation and <STDIN> when STDIN is
>the default for <>(Assuming no arguements).

array names made up of punctuation ? .. do you mean scalar names ? .. or 
did the surrounding single quotes in question 6 confuse you ?

>You may be suprised to know that when I got hired on this job, which
>contains a lot of Perl development of special use tools and maintenance
>of Perl/Tk legacy tools, that the interviewer asked me exactly one
>technical question.  "How do you declare a variable in Perl?"  Sigh.  Of
>course I took that way too seriously and started asking clarifying
>questions. "Scalar, Array or Hash?"  All the interviewer wanted was
>"With a Dollar sign."

the reason why I'll never hire a manager with no technical background :)

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 12 Sep 2000 13:36:13 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <39BE93BD.116ECB2E@stomp.stomp.tokyo>

David Steuber wrote:
> 
> "Godzilla!" <godzilla@stomp.stomp.tokyo> writes:
> 
> ' Employment Qualifications -
> '
> ' Write an imaginative and creative Perl script with a minimum
> ' of five-hundred lines which produces results which will give
> ' me a smile, make me laugh or simply amaze me. This script
> ' must bend, break, twist, mutilate and violate every Perl
> ' rule possible, yet run with lightning fast perfection. It
> ' must be written Perl 4 style and not use pragma hints nor
> ' any modules. Scoring will be by how surprised I am.
 
> Well, I guess I'll never work for you.  I use Perl 5.6, strict and any
> modules that are useful to me to get the job done with a reasonable
> LOC and time invested.


Clearly I am not hiring and, these are rhetorical musings.

No, you would not work for me. Perl 5.6 is the most buggy,
error prone and unreliable version of Perl released to date.
It is a version which should never be used for anything more
than a home system and learning how to deal with problems.

Strict indicates a reduced ability to write relatively error
free programs and, indicates a reduced ability to debug a
program without artificial assistance.

Modules tell me you are a copy and paste specialist rather
than a  talented programmer who can write programs sans
a need for modules.

Your use of "LOC" indicates a diminished ability in effective
communication. I have no clue what this means and, many others
would have no clue. Hmm.. LOC, Lots Of Crap? Loser On Computer?


Anyhow, a true test of programming skills would be to comply
with my original qualifications; actually write a program
sans copy and paste techniques. This sorts real programmers
from copy and paste specialists.



> Happiness is a SAAB Gripen <http://www.gripen.saab.se/> in the
> garage, an FN-FAL in the safe, and an HK P7M8 on the hip.


Happiness is a classic Corvette Mako Shark, a 9mm Beretta in
your personal valice and, rocking n rolling with a Colt AR-15,
all of which I have, along with happiness. =)


Godzilla!
-- 
Hey Joe, where ya going with that gun in your hand?
  http://la.znet.com/~callgirl3/heyjoe.mid


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

Date: Wed, 13 Sep 2000 07:55:18 +1100
From: jason <elephant@squirrelgroup.com>
Subject: Re: Qualifications for new Perl programmer?????
Message-Id: <MPG.1429352f28d6ee5598978c@localhost>

Ilmari Karonen <iltzu@sci.invalid> wrote ..
>In article <slrn8rotnf.1bt.tjla@thislove.dyndns.org>, Gwyn Judd wrote:
>>I was shocked! How could jason <elephant@squirrelgroup.com>
>>say such a terrible thing:
>>>
>>>I'm not a big believer in 'qualifications' in the conventional sense of 
>>>the word .. but I did ask that everyone complete the following quick 
>>>quiz .. I sprung it on the candidates and they had to complete it 
>>>without referring to any references
>
>I could answer each of your questions, but I would've - like you later
>told some of your candidates did - complained about you disallowing
>the use of reference material.  The knowledge that interpolated arrays
>are joined by $" while the arguments to print() are joined by $, isn't
>really doing anything for me except taking up space in my mind.  All I
>_need_ to know is that the answer is in perlvar(1).

ahah !! .. that was why those were bonus point questions only .. and in 
any case - it wasn't a "if you can't get 100% then you're not getting 
the job" type quiz .. it was just for me to use as a guideline

I would have hired ANYONE who could have answered all the questions 
without getting either bonus points .. to be honest - I felt that the 
quiz was going to be too easy (my brief to the agencies asked for a Perl 
Programmer and included several zeros) so I wanted to include some 
slightly more difficult questions

>I'm currently employed as a Java programmer, but I couldn't write my
>way out of a paper bag without Sun's javadocs at hand.  I simply can't
>be bothered to memorize the twisted jigsaw puzzle of strongly typed
>method calls they like to call the core API.  Especially the IO part.

I am also doing quite a lot of Java work currently .. and I also work 
from the docs a lot .. but that's mainly due to the extra complexities 
that Java's tight typing introduces

and mainly I use the docs to look up the JDK documentation .. all the 
questions that I asked were related to perl syntax and semantics .. I 
didn't ask anything about the standard modules (akin to the JDK)

this a question for Java that is the along the same lines as question 1 
from the Perl quiz (I hope that most people with any java experience 
would be able to answer this - and most people with C/C++ experience 
should be able to answer it too)

 In the following program, explain the difference between the two
 variables x and y, specifically making reference to their scope.

   class foo
   {
     static int x = 0;

     static void main( String[] args )
     {
       int y = 0;
     }
   }

if I was looking for someone to do some serious programming then I might 
also ask about things like the difference between 'public', 'private' 
and 'protected' .. or what the difference between the following two 
variables is

  int[] x;

  int x;

that sort of thing .. I'd expect anyone with Java experience to be able 
to answer them without reference material .. I might give a bonus point 
for explaining what the Object method 'notify' does .. something like 
that

>>>3. Rewrite the following code so that it successfully does what
>>>   it's trying to do ?
>>>
>>>	$x = (STDIN);
>>>	print 'You just typed $x/n';
>>
>>$x = <STDIN>;
>>print "You just typed $x\n";
>
>Questions like this are inherently ambiguous, but I would've omitted
>the \n from the string since that is probably the desired effect.  I
>can just imagine the author posting here with "Subject: Double spaced
>output!!!" after getting everything else right..

you think that if someone accidentally wrote

  print 'You just typed $x/n';

that the desired effect would be

  print "You just typed $x";

?? .. I don't see it as ambiguous .. but in any case .. it wasn't a 
standardised test where I didn't talk about the answers afterwards .. I 
can assure you that if you had have even got as far as above then you'd 
be going well .. one answer was as follows

  $x = STDIN();
  print 'You just typed.$x."/n"';

now - to me that says (1) this person doesn't realise the significance 
of 'STDIN' .. (2) they have no idea about double-quoted strings .. (3) 
they probably program by taking another program and munging it so 
they've never had to write \n, \t, etc. from scratch .. (4) generally 
they almost certainly do not program in Perl regularly

so .. the point was not to get the answers right .. the mistakes tell me 
a lot about someone's Perl experience .. for example - the majority of 
people who tried the above question wrote answers with glaring syntax 
errors in them

-- 
  jason -- elephant@squirrelgroup.com --


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

Date: Tue, 12 Sep 2000 19:26:44 GMT
From: charlie.bursell@healthcare.com
Subject: Reading piped input on Windows NT
Message-Id: <8pm00q$86t$1@nnrp1.deja.com>

How, or can, I get piped data in perl on Windows NT?

For example, if I enter "type foo | myperl" in Windows NT, how do I read
the data.  The data IS NOT availabl via STDIN as in Unix.

Thanks

Charlie


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 12 Sep 2000 19:54:44 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Reading piped input on Windows NT
Message-Id: <8pm1lp$a3h$1@nnrp1.deja.com>

In article <8pm00q$86t$1@nnrp1.deja.com>,
  charlie.bursell@healthcare.com wrote:
> How, or can, I get piped data in perl on Windows NT?
>
> For example, if I enter "type foo | myperl" in Windows NT, how do I
read
> the data.  The data IS NOT availabl via STDIN as in Unix.
>
> Thanks
>
> Charlie

i presume myperl is a perl script...say.. "thing.pl", where pl is
asscociated with the perl interpreter.

try:

type foo | perl myperl.pl

Brendon
++++


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 12 Sep 2000 14:58:53 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Reading piped input on Windows NT
Message-Id: <39bea71d@news.victoria.tc.ca>

charlie.bursell@healthcare.com wrote:
: How, or can, I get piped data in perl on Windows NT?

: For example, if I enter "type foo | myperl" in Windows NT, how do I read
: the data.  The data IS NOT availabl via STDIN as in Unix.

if myperl is a batch file that perl -x 's itself, then STDIN is available
(i use that all the time)

and 
	type foo | perl perl_script

also works for me.

If myperl is actually myperl.pl, and NT knows its a perl file via the
registry then STDIN may not work because a new window is opened for the
perl script, but there's a help file with Active state perl that explains
how to stop secondary windows being opened for perl scripts, and then I
would expect the above to work too (though I haven't tried it)



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

Date: Tue, 12 Sep 2000 21:43:29 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: RFOL: zap dupes, preserve order
Message-Id: <5sxv5.113$W3.170616832@news.frii.net>

In article <x74s3phtjn.fsf@home.sysarch.com>,
Uri Guttman  <uri@sysarch.com> wrote:
>
>@unique = do { my %h; grep !$h{$_}++, @has_repeats } ;
>

From my .profile

    PATH=`perl -le 'print join(":", grep {!$t{$_}++} split(/:/,$ENV{PATH}))'`

chris
-- 
    This space intentionally left blank


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

Date: Tue, 12 Sep 2000 13:23:40 -0700
From: "Someperson" <nothing here! complain about that!!!>
Subject: Re: Running external programs and grabbing the output
Message-Id: <srt3an6oct639@news.supernews.com>

To be perfectly honest, yes, it seemed far too obvious and hence my posted
question.

But I can see that you are a professional troll (domain and everything!) so
a smartass reply at my expense was to be expected.  Thanks for filling that
role.

To think I named my dog Abigail....

"Abigail" <abigail@foad.org> wrote in message
news:slrn8rqu95.pg4.abigail@alexandra.foad.org...
> Someperson (nothinghere!complainaboutthat!!!) wrote on MMDLXIX September
> MCMXCIII in <URL:news:srqti06rct6164@news.supernews.com>:
> %% Hi
> %%
> %% I am trying to figure out where to start here.  I have an NT command
line
> %% utility that I want to grab the output from and send input to.  It runs
by
> %% passing it one string of args, and the output is one string.
> %%
> %% I assume something like this:
> %%
> %% system "myprogram.exe -arg1 -arg2";
> %% $output = <STDOUT>;
> %% print $output;
> %%
> %% ....would not work.
> %%
> %% Any idea where I should look for some instruction on this?
>
>
> How about the Perl manual? For instance, starting by what the manual
> has to say about *drumroll* system?
>
> Or would that just be too obvious?
>
>
>
> Abigail
> --
> $_ = "\x3C\x3C\x45\x4F\x54" and s/<<EOT/<<EOT/e and print;
> Just another Perl Hacker
> EOT




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

Date: 12 Sep 2000 19:53:15 +0200
From: Christian Meisl <meisl@amvt.tu-graz.ac.at>
Subject: Startup error at Perl/Tk?
Message-Id: <m3pum9mr90.fsf@famvtpc59.tu-graz.ac.at>

In my Perl/Tk program I have to read data at startup. The opening of
the file is done with

open (GNV, ".gnv") or die "Cannot open .gnv: $!\n";

But this line requires a shell from which my Perl/Tk script is
executed. How can I place a dialog box that displays that "cannot..."
and an OK button instead of a simple die? At this time of the
execution I do not have a MainWindow yet...

Best regards,
Christian

-- 
Christian Meisl <meisl@amvt.tu-graz.ac.at>        www.amft.tu-graz.ac.at
   Inst. f. Apparatebau, Mech. Verfahrenstechnik und Feuerungstechnik
------ The pure and simple truth is rarely pure and never simple -------
PGP fingerprint:       DF48 2503 0411 F0EF 149C 851B 1EF0 72B9 78B6 034A


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

Date: Tue, 12 Sep 2000 18:20:19 GMT
From: Yanick Champoux <yanick@babyl.sympatico.ca>
Subject: Re: Startup error at Perl/Tk?
Message-Id: <Dtuv5.232330$Gh.5322373@news20.bellglobal.com>

Christian Meisl <meisl@amvt.tu-graz.ac.at> wrote:
: In my Perl/Tk program I have to read data at startup. The opening of
: the file is done with

: open (GNV, ".gnv") or die "Cannot open .gnv: $!\n";

: But this line requires a shell from which my Perl/Tk script is
: executed. How can I place a dialog box that displays that "cannot..."
: and an OK button instead of a simple die? At this time of the
: execution I do not have a MainWindow yet...

: Best regards,
: Christian

Disclaimer: my knowledge of Perl/Tk is nex to null. I bet there is
a better way to do this, but...

#!/usr/bin/perl
use Tk;
use Carp;
 
sub tk_die
{
        my $message = shift;
        my $mw = MainWindow->new;
        $mw->Dialog( -text => $message, -title => 'Fatal Error' )->Show();
        croak $message;
}
 
open GNV, ".gnv" or tk_die "Cannot open .gnv: $!";

__END__

Joy,
Yanick

-- 
eval" use 'that poor Yanick' ";
print map{ (sort keys %{{ map({$_=>1}split'',$@) }})[hex] }
qw/8 b 15 1 9 10 11 15 c b 13 1 12 b 13 f 1 c 9 a e b 13 0/;


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

Date: Tue, 12 Sep 2000 18:33:50 GMT
From: cd_root@my-deja.com
Subject: Test Your Perl Skills
Message-Id: <8plsud$42l$1@nnrp1.deja.com>

Network Essentials Inc hosts "Get Certified!", dedicated to helping
build the knowledge base required to demonstrate technological skills.
We are pleased to announce our newest database of questions for perl.

The perl question database is new, so we'll be adding questions every
week. Check back often.

     http://www.networkessentials.com/certified/perl

We also have databases for unix (Solaris) at:

     http://www.networkessentials.com/certified/sca

and Oracle's certified professional at:

     http://www.networkessentials.com/certified/ocp

and Compaq's OpenVMS system management at:

     http://www.networkessentials.com/certified/vms

jc


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Tue, 12 Sep 2000 21:35:00 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Test Your Perl Skills
Message-Id: <x7r96pgupm.fsf@home.sysarch.com>

>>>>> "cr" == cd root <cd_root@my-deja.com> writes:

  cr> Network Essentials Inc hosts "Get Certified!", dedicated to helping
  cr> build the knowledge base required to demonstrate technological skills.
  cr> We are pleased to announce our newest database of questions for perl.

get lost. certification is for those who don't know how to tell if
someone knows anything.

uri

-- 
Uri Guttman  ---------  uri@sysarch.com  ----------  http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page  -----------  http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net  ----------  http://www.northernlight.com


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

Date: Tue, 12 Sep 2000 12:16:11 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: This *should* be easy, string parsing question
Message-Id: <39BE80FB.40912A51@ipac.caltech.edu>

Adam Trace Spragg wrote:
> 
> Peter J Scott <peter@psdt.com> wrote:
> : %value = /([^=]+)=([^&]+)(?:&|$)/g;
> 
> Would someone mind please adding a little English to this? 

From anywhere in the string, match one or more non-"=" char.s (saved in $1)
followed by "=", followed by one or more non-"&" char.s (saved in $2) followed
by "&" or the end of the line (not saved). For every match on the line, use $1
as a hash key in %value and enter $2 as its value; like '$value{$1} = $2'.

Quiz: Is that trailing '(?:&|$)' necessary?

--

-- Tim Conrow         tim@ipac.caltech.edu                           |


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

Date: 12 Sep 2000 21:58:17 GMT
From: Adam Trace Spragg <spragg@cs.ucdavis.edu>
Subject: Re: This *should* be easy, string parsing question
Message-Id: <8pm8tp$kfu$1@mark.ucdavis.edu>

Ren Maddox <ren.maddox@tivoli.com> wrote:
: Adam Trace Spragg <spragg@cs.ucdavis.edu> writes:

:> Peter J Scott <peter@psdt.com> wrote:
:> : %value = /([^=]+)=([^&]+)(?:&|$)/g;
:> 
: Here it is expanded:
[snip]
: So the result is a list of each parameter name and its associated
: value, in that order.  Assigning such a list to a hash "does the right
: thing" and creates a key/value pair for each pair in the list.

Ahhh...  I didn't realize that that's how assignment of a RE worked, and that's
what I as hung up on.

Thanks so much!

Adam



: Note that the much simpler:

: %values = split /[=&]/;

: is just as effective on this data, but the RE handles the (perhaps
: undesirable) case of a parameter having a "&" in it.  The split, on
: the other hand, basically blows up if that happens (though if it
: happens an even number of times, it doesn't blow up it just messes
: up).

: $_="here&is=some&bad=data";

: The RE will simply take "here&is" as a parameter, while the split
: doesn't treat "&" or "=" any different, so gets confused.

: -- 
: Ren Maddox
: ren@tivoli.com


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

Date: Tue, 12 Sep 2000 22:22:54 +0100
From: "Brian" <brian@ukdj.freeserve.co.uk>
Subject: Where Doesn't this work?
Message-Id: <8pm78b$ck1$1@news6.svr.pol.co.uk>

Where Doesn't this work? i am trying to remove all " from the file when it
is read in?

my($SIZE,$i);
 open (FILE,"$productdb") || die "Content-type: text/html\n\nCan't Open
$productdb(r): $!\n";
 my(@LINES)=<FILE>;
 @LINES =~ s/\"//g;
 close(FILE);
 $SIZE=@LINES;


Brian






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

Date: Tue, 12 Sep 2000 21:43:38 GMT
From: Allan M. Due <All@n.Due.net>
Subject: Re: Where Doesn't this work?
Message-Id: <MPG.14286d5dccd3c347989680@news>

In article <8pm78b$ck1$1@news6.svr.pol.co.uk>, brian@ukdj.freeserve.co.uk 
says...
|Where Doesn't this work? i am trying to remove all " from the file when it
|is read in?
|my($SIZE,$i);
| open (FILE,"$productdb") || die "Content-type: text/html\n\nCan't Open
|$productdb(r): $!\n";
| my(@LINES)=<FILE>;
| @LINES =~ s/\"//g;
^^^^^^^^^^^^^^^^^^^
The where is right there.  Perl is very DWIM but everything has its 
limits.  I think you might want to iterate over that array.

HTH

AmD

-- 
$email{'Allan M. Due'} = ' All@n.Due.net ';
--Random Quote--
Skill in manipulating numbers is a talent, not evidence of divine 
guidance.
  Ashley-Perry Statistical Axioms[2]


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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 V9 Issue 4303
**************************************


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