Tuesday, June 16, 2009

Perl's flexibility

I was suspecting Perl to be rather flexible and implementing the principle "type as you think and get it working" (which does not apply always as Perl is 'weird' by definition), but could not imagine it goes that far:


sub getHeaderName
{
return (split " - ", shift)[1]; # let's see if it works. Upd: it works!
}



, where input string is of type: "process_type - process_name" and I need process_name value from it.

No comments: