Perl 5.10.0 introduced a new pragma, "features". One of the features is "switch":
use features 'switch';
There are some new keywords to use with switch statements: given, when and default.
Read about this new feature and other changes to perl in the History/Changes pages on perldoc...
Perl has recently been updated to version 5.10.0. There were a number of changes to the core modules, pragams, and functions. I updated the Perl Syntax Highlighter script some of you use to include the changes. You can select to highlight code as perl 5.8 or perl 5.10 when using the syntax...
OK I went ahead and fixed the file renamimg scheme for repeated files:
file.txt
file_1.txt
file_2.txt
#!/usr/bin/perl
use strict;
use warnings;
use File::Path;
use File::Copy;
use CGI::Carp qw/fatalsToBrowser/;
$|=1;
print "Content-type: text/html\n\n";
print '<plaintext>';
# uncomment next...
I just noticed that Miller is now numero uno on the MVP list. Congrats to him, keep up the good work. You've really been doing a great job since joining this forum Miller.
Regards,
Kevin (aka numero dos) [smile]
------------------------------------------
- Kevin, perl coder unexceptional! [wiggle]
The code:
sub sort_by_num {
return $a <=> $b;
}
@arr = (500,1,400,5);
foreach (sort sort_by_num(@arr)) {
print ("$_\n");
}
the output:
1
5
400
500
My question is why is that weird code producing that weird output? This is not real code, I am just asking out of curiousity...
Tek-Tips Forums - Home
Community News
* Congratulations fishiface on being voted TipMaster of the Week by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!
I salute in your general direction [2thumbsup]
I don't look at the home page of tek-tips too often, I generally just enter the perl forum directly. But with nothing going on I decided to look who is TipMaster of the Week (PHV, his stats are enough to give me an inferiority complex!) but low-and-behold on the MVP list on the home page:
MVPs...
This is a tangent to this thread:
http://www.tek-tips.com/viewthread.cfm?qid=1095895&page=1
As I was testing code, I noticed that the pair "AC" seemd to be starting most of the 8 base-pair sequences. I would have thought that since it's random any base-pair could start a sequence. Maybe there...
Is there anyway to make File::Find not traverse through directories but stay in the current directory? The documentation doesn't seem to suggest so and a few things I tried didn't stop File::Find from accomplishing it's mission in life.
Should I just be using readdir() and File::Basename to...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.