Take heed the quote from the Book of the Camel:
"You will be miserable until you learn the difference between scalar and list context."
lest you end up like the high school kid who now has a criminal record for a simple mistake.

-- Randal L. Schwartz, Perl hacker

update: Please keep in mind that I'm particularly sensitive to this subject because of my own ongoing legal case where I became a felon over a misunderstanding.
  • Comment on Beware - improper context usage can be considered criminal activity!

Replies are listed 'Best First'.
Re: Beware - improper context usage can be considered criminal activity!
by arturo (Vicar) on Mar 14, 2001 at 19:46 UTC

    What I'd like to hear from various monks (and your stories need not involve criminal charges, actual or threatened) are stories about how failing to understand subtleties like list/scalar context differences caused you trouble. Feel free to change names, attribute them to cow orkers, etc. I just wanna hear the stories, not embarass or belittle anybody!

    I don't have any stories like this, my biggest errors are stupid things like nearly crashing a Sun Enterprise class system by failing to delete my large files in /tmp =)

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

Re: Beware - improper context usage can be considered criminal activity!
by McD (Chaplain) on Mar 14, 2001 at 22:09 UTC
    With all due respect, it doesn't look like the kids actually have a "criminal record" here.

    According to the story, they were questioned by police, who are keeping their notes on file:

    His father repeated to me twice, as if he couldn't quite believe the whole thing had actually happened, that the police gave him a case number and are keeping the report on file.

    No charges, no arrest, no conviction, just some notes in a file folder in a detective's filing cabinet somewhere. That's not quite a criminal record.


      Funny article!

      Funny too, that when I get stuck on something at times I can just randomly browse PerlMonks....not even a directed search and find my answer. Indeed mystical.

      I've been looking for a way to quote safe a large array of strings for entry into a database (can't have the ' without screwing up syntax)

      but the DBI ->quote( @array ), it doesn't like,

      so I've been trying to get all of @array into a single string because THAT I can quote.

      but NOW

      I understand why my $allofarray = @array returns a number of elements in the array, but my ( $allofarray ) = @array returns the first string in the array....now to just figure out how to get all of the elements into one long string...

      "No matter where you go, there you are." Jeff Pflueger - Struggling Perl knowledge sponge

        use join

        $ perldoc perldoc
Re: Beware - improper context usage can be considered criminal activity!
by mr.nick (Chaplain) on Mar 14, 2001 at 19:43 UTC
    LOL! If there ever was a better example of the consequences of not understanding this, I haven't seen it.

    Though I suspect this level of backlash won't happen often. Gods, I hope it doesn't at least.

Re: Beware - improper context usage can be considered criminal activity!
by gopher (Monk) on Mar 16, 2001 at 07:27 UTC

    Sadly, i can see something like this happening at my school. i almost faced a suspension for telnetting to my linux box at home. the offense? i knew how to use telnet. nothing more then that. it wasnt the sys-admins that cared i was using telnet, it was the principals. it seems to me like the people who know the technology should deem punishments appropriate in such cases. id hate to see what a scalar error would cost me.

    Mr. Zoothornrollo, hit that long lunar note, and let it float.

      Rather than telnet, you should use ssh. If you need to connect from Windows, you can always use the putty client.
        If his school was indeed freaked over his using telnet, just think how they'd react to ssh! Bomb-sniffing dogs are well within the range of possibilities, given how schools have been reacting of late.

        SSH is a Very Good Thing, but perhaps not the best of advice in this particular case.

Re: Beware - improper context usage can be considered criminal activity!
by scottstef (Curate) on Mar 15, 2001 at 20:57 UTC
    Reading this case- it is almost as big of a crock as the one brought against you. Thanks for bring it up. We were discussing your case on its merits or lack of after i griped at work after asking the head of security if i could run some scans on our network and (he said no- so i didn't (I learned from your story)and one of the guys i work with told me he always just went ahead and did them). It was really funny when 3 weeks later someone logged into a box and noticed. At least the place i worked for just gave him a talking to. In regards to these kids, it amazes me how screwed up our schools are. My wife is a guidance teacher at a public school, the kids there go to the extreme opposite in regards to what they get away with.