• About: Master Programmer, Perl Guru, & Avid Gamer
  • Commented on Converting glob patterns to regular expressions
    Or you could use a hash for the convertion: my %convert = ( '*' => '.*', '?' => '.', ); s/(\W)/$convert{$1}||$1/eg;...
  • Commented on What is in The End?
    What's wrong with recursion? A look at recursion....
  • Commented on Is Perl really short of newbies?
    TIMTOWTDI: That's because there is always more than one way to do it, regardless of language. Perl just acknowledges the truth. I've been programming in Perl since version 4. Before that, I used awk, sed, and grep. Back then, Perl...
  • Commented on On Readability
    Saying syntax has no effect on the usability of a language is like saying arithmetic is just as easy with Roman numerals as it is with Arabic numerals....
  • Commented on Change Counting Problem - Feedback Requested
    Put 1¢ to 24¢ in an array: my @small = ( "", "1 penny\n", "2 pennies\n", "3 pennies\n", "4 pennies\n", "1 nickel\n", "1 nickel\n1 penny\n", "1 nickel\n2 pennies\n", "1 nickel\n3 pennies\n", "1 nickel\n4 pennies\n", "1 dime\n", "1 dime\n1 penny\n", "1...
  • Commented on A Tiny Code Quiz
    Try this one: use Data::Dumper; my @a = ( 1 .. 10 ); my $count = () = @a; my @list = () = @a; print Data::Dumper->Dump( [ \@a, $count, \@list ], [qw( *given *count *list )]);...
  • Commented on What if Perl OO was a Core Feature?
    sub new { my $class = shift @_; my $self = { @_ }; return bless $self, $class; } That is not simple?...
  • Commented on What if Perl OO was a Core Feature?
    @Toby Inkster -- my point is that OO should not be used for everything. @Stevan Little -- see above comment about OO fanatics insisting that OO be use for everything. @Olivier Mengué -- You will note how popular Perl 6...
  • Commented on What if Perl OO was a Core Feature?
    Stevan Little -- "Once you start down the dark path, forever will it dominate your destiny." I simply don't believe that once OO is added to Perl, the religious fanatics won't insist OO for everything....
  • Commented on What if Perl OO was a Core Feature?
    If OO becomes part of the core of Perl, I'll learn a new language. The only part of OO that's worth anything is encapsulation and Perl does that with packages. Inheritance is a distraction; Perl already does polymorphism; and code...
  • Commented on I translate "Modern Perl Writing Style" to English
    You should add a section on using Perl::Critic and its script, perlcritic. This will tell you everything about a Perl script or module that is not compatible with PBP. If you use the three argument open, you can use an...
  • Commented on Writing the Perl I Want to See in Others
    Have you tried Perl::Critic and Perl::Tidy?...
  • Posted A Look at Finding Out-of-Date Files to shawnhcorey

    A function for comparing the modification time of files to determine if a file is out of date with respect to its sources.

    A Look at Finding Out-of-Date Files

  • Posted A Look at Perl to shawnhcorey

    Two new articles for my blog. The first is on creating a trim() function and its test. The second, is on creating a friendlier interface to Data::Dumper.

    A Place for the Tests

  • Commented on function return in scalar context
    I don't like it because it changes the behaviour of Perl by placing two relevant items far apart. As far as programmers go, out of sight is out of mind. The `use Function::ScalarReturn` has to be place near where the...
  • Posted A Look at Conditional Compiling of Diagnostics to shawnhcorey

    Is it possible to have conditionally compiled diagnostics in your script and to ensure they don't get printed in production?

    Yes, it is.

  • Posted A Look At My Utility Library to shawnhcorey

    I am creating a utility module and will be posting about it on my blog.

  • Commented on Encapsulating Responsibility in Methods
    @Ovid: Why should Y be derived from X? That's a big assumption. @Gabor: Big systems that work started as small systems that work. Or, "Whatever happened to FORTRAN III?"...
  • Commented on Encapsulating Responsibility in Methods
    Suppose you have a object A that calls a method in B that calls C that throw an exception X that is caught by A. Now, suppose you change C in B to D, which throws exception Y. You now...
  • Commented on Encapsulating Responsibility in Methods
    Except for exceptions. If you have to change one, you must scan all the code to find were they are caught, to make sure the version will work....
  • Commented on Please provide an abstract for posts to
    I hear you.
  • Posted A Look at Cartesian Products to shawnhcorey

    A new post in my blog about Cartesian products.

    Problem: You have a number of sets and you want all the combinations when choosing one element from each set.

    In mathematics, these…

  • Posted A Look at Recursion to shawnhcorey

    I created a blog about Perl over on Blogger and I have just posted an new article on recursion.

  • Commented on C Programming: What is the difference between an array and a pointer?
    Yes, pointers in C will drive you batty. Perl's references are much easier to understand....
  • Commented on Algebra of Grammars?
    "'putting F first means I never gets a chance to parse anything' has more to do with algebra of parser combinators that is defined in terms of parse results rather than parseable sets." Yes but why build a parser if...
  • Commented on Algebra of Grammars?
    Note that: I ⊂ F I <+> F can parse I or F but it is not commutative. F <+> I = F Since F can parse everything I can, so putting F first means I never gets a chance...
  • Commented on ----perl--hello
    It worked! ;)...
  • Commented on The comma operator
    consistency = predictability inconsistency = gotchas...
  • Commented on Subroutine Signatures - my Plan (v.1)
    I did something similar in my Sub::Starter module; only I called them usage statements. Sub::Starter is a filter that converts usage statements into sub skeletons. It is easier to write a usage statement than a consistent sub & its documentation....
  • Commented on The comma operator
    $ perl -E'$a = () = (6, 1, 1, 1, 7); say $a;' 5 $ perl -E'@a = () = (6, 1, 1, 1, 7); say @a;' $ Why? In the first one, the array is kept. In the second,...
Subscribe to feed Recent Actions from shawnhcorey

  • vijaykumar.tater commented on Is Perl really short of newbies?

    One of the main reason is people are lazy.and the good thing is we can use this laziness for more participation. i gave a simple demo on how to use perlbrew and use cpanm to download modules. i told them not to write a lot of code, but just use cpan to find out a module that caters to their task and use it. It helped them get started with using cpan. i gave them a demo on DBIx::Class (i am a poor presenter) but i wanted to make them understand, the pain on unreadable code.and how DBIx::Class would help them keep things clean. and predictable. but soon realized things went over their head. i…

  • Ron Abraham commented on Is Perl really short of newbies?

    I am just getting back into perl (did a lot of cool and appreciated work during college ) after a 10 year hietus but always loved the language.So i guess im a newbie.

    I want perl to take of in a big way as i feel the language has a soul and culture that is unique.

    I feel we need to take on big projects like /RT/bugzilla /movable type etc to kick some a**.

  • mug896 commented on Perl vs Shell Scripts

    In bash you cant set IFS=$'\n' instead of IFS="

  • Neil Bowers commented on Converting glob patterns to regular expressions

    You could have a look at glob_to_regex() in Text::Glob.

    I haven't checked it, but if it doesn't handle the cases discussed here, you could submit a PR tomorrow, as part of your CPAN Day celebration :-)

    And while you're there, you could add the github repo to the dist's metadata, so it will appear in the sidebar on MetaCPAN.

  • smls commented on Converting glob patterns to regular expressions

    I wrote this once, for one of my own scripts:

    # Given a glob pattern, return a regex that has the following behavior when
    # matched against Cwd::realpath canolicalized path strings:
    #  - matches successfully if and only if the path would have been matched by
    #    the original glob
    #  - $1, $2, ... will contain what would have been matched by groups of
    #    consecutive wildcards (*, ?, [...]) in the original glob
    #  - $::REGMARK will contain the numeric index of the "brace expansion"
    #    alternative in the original glob that would have first matched the path
    # If  tree => 1 …
Subscribe to feed Responses to Comments from shawnhcorey

About is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.