Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
Problems? Is your data what you think it is?


by ambrus (Abbot)
on Oct 01, 2003 at 11:47 UTC ( #295576=user: print w/ replies, xml ) Need Help??

Image: gravitational anomaly, somewhere in France, August 2007.

Favourite pentomino pattern:

My homepage doesn't have anything interesting on it.

To determine if a number is odd or even, the worst way is:


There are several completely different programming concepts called a select statement. They are

  • The select system call in unix, which is the most common way a process can wait for events and give up the process's claim on CPU. Its prototype is int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);. It also has a perl interface: the select builtin function which has three or four arguments.
  • The one-argument select function of perl, which selects a filehandle to be the default filehandle, so that unqalified print operations and a few special variables would refer to it. This accidentally has the same name as the previously mentioned select function, and can only be distinguished by the number of arguments.
  • The select special command in bash-like shells, which is a loop construct that prints a simple text-based menu and reads user input.
  • The SELECT construct in the SQL language.
  • The SELECT special statement in newer dialects of BASIC, which is similar to pascal or scheme case statements. It dispatches between multiple choices comparing a single value to different constants for each branch. In earlier BASICs, the ON ... GOTO construct was used instead.
  • It is not a statement, but smalltalk and ruby have a select method which filter elements from a list, similarly to perl's builtin function grep. Also both maple and mathematica have functions called select and Select resp., and these serve the same purpose.
  • Also not a statement, but HTML has a select element that is a form control displaying a dropdown list. Related to this, the CGI perl module has a Select function and method, and the WWW::Mechanize module has a select method. (One could say though that this has the same etimology as the select statement in shells.)
  • However, HTML DOM also has a select event (unrelated to the select element) and HTML has a corresponding onselect attribute, which is called when the user changes the selection in a text input field.
  • The Magma computer algebra system has a select keyword which it uses in the conditional expression.

Ok, after all this rant, here's something that's actually useful to know. The formulae to solve the quadratic equation
a x^2 + b x + c = 0
x_1 = -(b + sgn(b) sqrt(b^2 - 4 a c))/(2 a)
x_2 = c/(a x_1)

Perl Quiz of The Week #21 (20040805): Task scheduling. my solution discussion.

Perl Quiz of the Week Expert #22 (20040825): Word ladder. my solution discussion.

Log In?

What's my password?
Create A New User
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2014-04-17 02:24 GMT
Find Nodes?
    Voting Booth?

    April first is:

    Results (437 votes), past polls