sub adjusttype {
my ($record) = @_;
SWITCH: {
(
$y[0] =~ /Local/
or $y[0] =~ /Announc/
) && do { $record->{type} = 'Talk'; last SWITCH; };
( $y[0] =~ /and answers/ )
&& do { $record->{type} = 'Question and answers'; last SWITCH; };
( $y[0] )
&& do { # strip the type from the title (if exists)
$record->{title} =~ s/$y[0]//g;
$record->{type} = $y[0];
last SWITCH;
};
}
Rants and ravings of a semi-autistic developer who has a hard time remembering idiotic nonsense details. Why remember it, when you know where to find it.
Wednesday, November 16, 2011
Switch/case with regular expressions in Perl
Creating a switch/case in perl with regular expressions are the input, similar to bash' wildcarding.
Tuesday, November 1, 2011
For Do Loop in Bash as one liner
Take note of the semi-colons ... that is the key
$ for i in {1..35}; do echo $i; done;
Subscribe to:
Comments (Atom)