Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Snarky comments on the ddj perl quiz

by ruoso (Curate)
on Aug 23, 2007 at 11:00 UTC ( #634610=note: print w/replies, xml ) Need Help??


in reply to Snarky comments on the ddj perl quiz

2. scalar But scalar isn't a data type, or if it is, perl only has two data types, list and scalar. And there are fewer ways you can use a list than a scalar, so the correct answer is "list".

You know, I usually see Scalar as a data type. It's even mapped to SV* when you go to C. And no, when you consider scalar as a data type, you still have Array, Hash, Glob and Code. And yes, all of them are SV* also (the SV struct is binary compatible with all of them). Or did I miss something?

daniel
  • Comment on Re: Snarky comments on the ddj perl quiz

Replies are listed 'Best First'.
Re^2: Snarky comments on the ddj perl quiz
by ysth (Canon) on Aug 23, 2007 at 11:21 UTC
    I say "scalar isn't a data type" because all data is either a scalar or a list of scalars, so a scalar isn't really a type of data, just like dog isn't a type of poodle.

    Internally, yes, there are data types representing hashes, arrays, opcodes, etc., but at the Perl language level, arrays, hashes, globs, and scalars are variable types, not data types. And the only thing you can do with those variables is get data from them or put it into them, and that data is always a scalar or list of scalars.

      What do you mean a dog isn't a type of poodle? How else are you going to discriminate between Tory Bliar and all the other poodles?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://634610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (8)
As of 2020-11-25 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?