This was a real answer I am expecting from Ronald, our Perl Guru :-)
Thank you. I know my Perl "vocabulary", but I still don't know, how to use
properly "map". It is like learning a language: there is a big passive
vocabulary. You have to use your vocabulary, to turn it into an active one.
Seeing your code, it is so obvious and same time elegant.
On 04.08.2007 15:18, "Ronald J Kimball" <[EMAIL PROTECTED]> wrote:
>
> I'm not sure why you're going about modifying your Perl script in this
> way...
I have collected meanwhile so many Perl-Filters in my BBEdit Unix Support,
that I just wanted to add one more, TO AVOID TYPING. And I found it funny to
use a Perl-Filter to write Perl-Code ... I think the first pulsation of a
programmer is "laziness". Ok, I am far of being a programmer. But I am at
least lazy; good starting point :-)
> Do you have a lot of occurences to change? Why can't you just do a
> simple find/replace? Won't you still need to write the code to use the
> variables that you're declaring? You could add the declarations at the
> same time.
>
> Anyway...
>
> #!perl -p
>
> s{my (\$scalar)(\d),}{
> 'my (' . join(', ', map $1 . ($2 + $_), 0 .. 3) . ');'
> }ge;
>
> __END__
really genius solution ! And I forgot about the -p switch in Perl, an other
problem to find a solution to my laziness problem!
>
> replaces
>
> my $scalar1,
>
> with
>
> my ($scalar1, $scalar2, $scalar3, $scalar4);
>
> and similarly for any $scalarN.
>
> Ronald
Thank you again and greetings to all from Munich
marek
--
___________________________________________
the embassy for talented young musicians
Podium International | Marek Stepanek | [EMAIL PROTECTED]
http://www.PodiumInternational.org
___________________________________________
--
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>