[sf-perl] My perl idiom/"I like" of the moment

yary not.com at gmail.com
Wed May 12 11:39:54 PDT 2010


On Wed, May 12, 2010 at 11:17 AM, Randal L. Schwartz
<merlyn at stonehenge.com> wrote:
>>>>>> "yary" == yary  <not.com at gmail.com> writes:
>
> yary> $ perl -i bt2nz report_adinfinitum.sql
>
> I think you want "perl -pi bt2nz", or else nothing gets printed and your
> file is empty.

That would be the case if bt2nz was a list of s/// but it ends with
"print" (and has some additional logic). It's been working in practice
as listed.


On Wed, May 12, 2010 at 11:11 AM, Joe Brenner <doom at kzsu.stanford.edu> wrote:
> Doing it inside your editor would seem to make sense, but there's
> usually problems with that...  For example, there's the emacs
> query-replace (M-%), and query-replace-regexp (C-M-%), but then you
> don't get to use perl regexps, and if you've got more than a few
> transformations to do on each file, they'd be too awkward.

emacs has "shell-command-on-region" M-|
or a custom keybinding in vim


More information about the SanFrancisco-pm mailing list