Perl tip of the day (was Re: Wellington Perlmongers)
piers at ompa.net
Wed Sep 25 11:31:59 CDT 2002
Excellent - altho I don't ( fortunately ) have the problem of using
I have written a couple of articles lately, and attended OSCON so
perhaps people might be intereseted in such subjects as Perl based HTTP
proxies, embedding Perl in Daemons, and Perl and SAP R/3.
My blitherings are at:
On Wed, Sep 25, 2002 at 09:43:03PM +1200, Grant McLean wrote:
> Hi Piers
> Just to let you know we're not all ignoring you. I couldn't reply
> straight away since I was writing Tcl code :-(
> I'm all in favour of a bit more 'banter' on the list. What would
> you like to talk about?
> Perhaps since no one is asking questions, I could kick off with an
> unsolicited answer...
> Today's message is brought to you be the command line argument '-l'.
> The problem:
> I want to extract a list of subroutine names from a Perl .pm file.
> The solution:
> perl -n -e '/^\s*sub\s+(\w+)/ && print "$1\n"' filenames
> Unfortunately, although that works nicely on Unix, it doesn't work
> on Windows. At least not with the standard Windows command shell
> which only recognises double quotes. One alternative is to use
> the 'qq' double quoting operator:
> perl -n -e "/^\s*sub\s+(\w+)/ && print qq($1\n)" filenames
> But my tip of the day is to dispense with the quotes and use the
> '-l' option to append a linefeed onto every print:
> perl -nle "/^\s*sub\s+(\w+)/ && print $1" filenames
> Which is less typing too.
> Anyone else have a tip?
> > -----Original Message-----
> > From: Piers Harding [mailto:piers at ompa.net]
> > Subject: Re: Wellington Perlmongers
> > Hi Guys - I listen into the melbourne.pm list, and they seem to share
> > lots of ideas, and regularily publish work/articles etc. to the list.
> > Are people on this list interested in the same sort of thing, as it
> > would be good to try and inject some life back into it?
> > Also, as a kiwi overseas, it would be nice to have some
> > banter with the
> > Perl community back home.
> > Cheers.
> > Piers Harding
More information about the Wellington-pm