[Israel.pm] OT: how can you limit your search to a block in vi or emacs?

sawyer x xsawyerx at gmail.com
Mon Sep 8 02:46:21 PDT 2008


given you want to differ between @x and $x, $x and $x{$name},
$x[$num], i think regular editor (vim / emacs without a macro) does
not seem to cover it.
considering you're probably looking to add variable name replacements
to Pedro, while making sure you're allowing for similar names of
different typed variables (scalar, array, hash could have similar name
and not be mistaken), i think the best answer was to use typeglobs (as
suggested by Dov) or look into packages more specifically.
maybe the search could prompt for a package name (assuming by default
"main" or whatever is in the first "package" paragraph till it finds
another) and then parse the code using perl (i think adam kennedy has
something for that) and change all the variable names.

On Sun, Sep 7, 2008 at 8:34 PM, Gabor Szabo <szabgab at gmail.com> wrote:
>
> I often need to find (and maybe rename) all the ocurances of a variable.
>
> The problem is
> 1) if the same name is used in multiple places then my search keeps
>     going to the other places as well an does not stay within the scope.
>
> 2) how can I easily locate both @x and $x[2]  but not $x nor $x{name}?
>
> Gabor
> _______________________________________________
> Perl mailing list
> Perl at perl.org.il
> http://perl.org.il/mailman/listinfo/perl



More information about the Perl mailing list