Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

ambrus

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

Image: colorful houses in Stortorget, Gamla stan, Stockholm, Sweden, 2014.

My homepage doesn't have anything interesting on it.

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

$odd=0;{local($SIG{__WARN__},$^W)=(sub{$odd++})x2;+{1..abs($n)}};

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. The select function in Eigen is an elementwise conditional.
  • In the INTERCAL esoteric language, the ~ binary operator, called select, which does a compress operation on bits.

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
are:
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.

Favourite pentomino pattern:

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-03-19 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found