Script showing bad interpreter and will not run

前端 未结 4 1659
星月不相逢
星月不相逢 2021-01-21 10:03

I was sent a perl script over mail and asked to run it .I placed it on my local drive as is but when I tried to run the script it shows me

/usr/bin/perl^M: bad          


        
4条回答
  •  春和景丽
    2021-01-21 10:28

    In the absence of dos2unix, you can use tr (on Mac OS X) to strip the DOS / Windows new-lines:

    tr -d '\r' < old.pl > new.pl
    

    This will solve the "bad interpreter" issue.

    "Can't locate Gpu.pm in @INC" is a different issue. Either you don't have Gpu.pm installed on your Mac (or whichever computer on which you are running this, I'm confused by your comments) or it's not in your include path. I don't who what that script is or what it does. A quick look on http://search.cpan.org/ revealed nothing.

    If you can get that Perl module (presumably from whoever supplied oldfile), you'll have to ensure it is in @INC.

提交回复
热议问题