Hi Chap,


Chap Harrison wrote:
I've read perldoc perlrun but find it pretty confusing. Things I've tried unsuccessfully are:

#!/usr/bin/perl /dev/clipboard
#!/usr/bin/perl < /dev/clipboard
#!/usr/bin/perl -- /dev/clipboard


The body of the script always begins

while (defined (my $line = <>)) {
    ...etc
}


I'm not sure if that is what you want. Suppose these lines are in a file "foo.pl". Then you want foo.pl to run and for it to read in /dev/clipboard. In the above, it seems like you want Perl to run /dev/clipboard instead -- which is perhaps not what you are looking for.

You can avoid opening the file by taking it as STDIN:

foo.pl </dev/clipboard

Isn't that what you want?

Actually, I found your question interesting and not surprisingly, there is actually a Wikipedia article on it:

http://en.wikipedia.org/wiki/Shebang_(Unix)

Support of this is not limited to Perl, but whether or not the operating system recognizes it (since the use of #! is not Perl-specific). Based on what's in this article, it seems like this feature is not portable...though it doesn't say which systems would support it.

Good luck!

Ray


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to