pnkhakre has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: bash script to perl script
by Anonymous Monk on Oct 19, 2013 at 03:40 UTC
Re: bash script to perl script
by marto (Cardinal) on Oct 19, 2013 at 09:59 UTC
Re: bash script to perl script
by thomas895 (Deacon) on Oct 20, 2013 at 08:29 UTC

    It's easy! Just use magic like so:

    #!/usr/bin/perl use strict; use warnings; # ^^ part of every spell system("/path/to/script");

    Wow! It really is that easy! Now just skip past this unobtrusive black box below if you like the simplicity...

    Of course, that's not really useful, what I proposed there.
    Despite the question being laughably shallow and lazy, I feel compelled, pnkhakre -- should you choose to read this -- at least a little bit on how to achieve your goal.
    Perl isn't too difficult from most shells, when you think about it. Only, there's lots more system calls in a shell script because that's what it was designed for. Perl is more of a text processing language, which you can read all about in the relevant manual pages(you know how to find those, yes? if not- better start looking, it's pretty easy to find).
    While you could just change everything, it's better to leave most things be if they work. A startup script, for example, is not likely to see much improvement if written in Perl instead of the original shell language.

    But hey, it's your choice -- don't let me stop you!
    ~Thomas~ 
    "Excuse me for butting in, but I'm interrupt-driven..."
      I wrote a much better translator. It's self-contained:
      #!/usr/bin/perl use strict; use warnings; my $pipe; open $pipe, '|-', '/bin/sh'; while (<DATA>) { print $pipe $_; } close $pipe; __DATA__ echo "hello world" for i in 1 2 3 4; do printf "this is iteration %d of the loop\n" $i done