Changing the paragraph environment using keyboard

From Lyx Wiki Tips:

Steering the mouse pointer to the paragraph environment drop-down menu in order to get out of an enumerate or itemize environment was starting to annoy me, especially on the road without a mouse. Fortunately, there is a solution (which apparently is undocumented, at least I couldn’t find it):

Quoting Paul from the mailing list: “M-p (alt-p) followed by a space opens the environment list. From there, repeatedly typing the same letter cycles through all environment names starting with that letter.”

Perl: Some usefull tips

Some handy Perl commands that is not used as much.

Use ‘-‘ to refer to STDOUT & STDIN.

open(INP, ‘-‘) —> STDIN
open(OUT, ‘>-) —> STDOUT
$fh = IO::File->new(‘-‘,’w’) —> STDOUT

Following the filehandle with ‘-|’ opens the output of a shell command as a file.

open($fh, ‘-|’, ‘ls -l’);
open($fh, ‘-|’, ‘cat tmp.txt | sort’);

Similarly IO::Pipe can be used to get the same affect:

$fh = new IO::Pipe;
$fh->reader(qw(ls -l));

Then you can print the output

while (<$fh>) { print; }

Open a zipped file

open(INP, ‘-|’, ‘gunzip < tmp.txt.gz’);

Print the output of a subroutine inside a string

print “3+4 is @{ [addTwoNumbers(3,4)] }\n”;

Use IO::File to store filehandles into a hash array.

$fh{‘infile’} = IO:File->new(“tmp.txt”, “r”);
while (my $line = $fh{‘infile’}->getline) {
print $line;
}
$fh{‘infile’}->close;