in reply to csh-perl xlator

There isn't one at all, obfuscated or otherwise.

The thing that has always prevented anyone from writing such a program is that it's very hard! It's easy to do a really bad job, but to do a good job, you have to be very clever. For example, suppose you see this:

set bar=`echo $foo | awk '{print $5}' | cut -c1-4`
The obvious (bad) translation is:
$bar=`echo $foo | awk '{print \$5}' | cut -c1-4`
But the right translation is:
$bar = substr((split($foo))[4], 0, 4);
Anyway, aside from an April Fool's joke that Randal perpetrated a few years ago, there is no shell-to-perl translator that I know of.

Replies are listed 'Best First'.
Re: Re: csh-perl xlator
by a (Friar) on Dec 19, 2000 at 09:55 UTC
    A good learning process it to write a 'bad' or incomplete translator. Just going through and
    TMP="/tmp/cas.$$.out" to: $tmp = "/tmp/cas.$$.out"
    is useful and trying to map if ... ] then to if ( ... ) [ (sorry I'm a ksh fool) can be quite useful both in learning and in moving some of your stuff. The hard parts will still need to be done by hand.

    a