I'm doing some quick code generation (the output is Java), and I found myself writing the below routine. I like it because of the names I picked for the variables. Not exactly self-documenting (although it is when you think about it), but this is throwaway. You can probably tell what the code is doing and why I named the variables as I did, and you might be entertained.
sub uc_prop
{
my($prop) = @_;
my $p = substr($prop, 0, 1);
my $P = uc($p);
my $rop = substr($prop, 1);
return "$P$rop";
}
You do know Perl has ucfirst, right? (Score:1)
Re: (Score:2)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Whoa (Score:1)
LOL!
And you were leaving comments on perl 5 and 6 replying to my criticisms of the language? Maybe its time to change your sig:
"J. David works really hard reimplementing bult-in functions"
Third-rate programmers, unite!
Re: (Score:2)
My signature was a quote from someone here about me that was just so incredibly complimentary that I grabbed it and kept it. I suppose keeping it was a little pompous, but you know, it really built me up. And reminds me to try to be a good programmer even when circumstances aren't always conducive.
To that end, even my one-off crap used strict and warnings, but I guess it still doesn't get me out of the guilt from reinventing a wh
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:1)
Hey, I think its a really nice quote; personally I wouldn't use it in my sig - maybe just quote it in my website or something, dunno. I would treasure it just like you did, though.
ucfirst() has been around for ages, afaik. At least a decade, possibly much more.
Why did you quit doing Perl full time? Was it a decision or did the market push you to it? Just curious. Do you actually want to go back to writing Perl full-time?
I am currently doing Objective-C most of the time, and even though I miss some of
Re: (Score:2)
I changed jobs in 2007 in order to be able to move my family out close to my inlaws. In my previous job I was doing Perl with pressure to switch to Java. I traded that for doing Java after all, but closer to where I wanted to be, in a business environment that is somewhat saner.
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:1)
And for fun: (Score:1)
(Of course you can do the same thing more efficiently – and boringly:)
(The following one might be more efficient. Or it may not be.)
(The first one is cool though.)