[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Scribes] "Basic Perl Filters in BBEdit" Colum



On 1:05 PM 4/19/00 David Steffen <steffen@biomedcomp.com> wrote:

> I think this is something Brian could easily add to flesh out the
> column, or if Brian cannot, due to his hardware problems, this is
> something that someone with any experience with Perl filters in BBEdit
> could add very easily.

I'll try to include this in the paragraphs I give to Brian later.

In very rough form:

If your script reads from a file line by line and prints out the results
you are good to go.

Save it in the perl filters folder (inside MacPerl Support inside BBEdit
Folder).

Select the data you want to filter.  Run the filter from the perl
filters palette.

Whatever your script prints will replace the selection.

Here is quickie example that reverses the selected lines.  If it looks
like C it is because I am write C all day long and it influences my perl
(of which I don't do or know too much):

#!perl -w
use strict;

while ( <> )
{
    my $s = $_;
    
    chomp($s);
    
    my $ct = length($s);
    
    for(my $i=$ct-1; $i>=0; $i--)
    {
        print substr($s, $i, 1);
    }

    print "\n";
}

-- 
Jim Correia                                Bare Bones Software, Inc.
correia@barebones.com                     <http://web.barebones.com>

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-scribes-request@macperl.org