Print itself: Difference between revisions
Content added Content deleted
(added Perl programming solution) |
|||
Line 65: | Line 65: | ||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Interpreted only: |
|||
You can drop the substitute() if you plan to interpret rather than compile it.<br> |
|||
<lang Phix>puts(1,get_text(command_line()[2]))</lang> |
|||
It will not work, obviously, if you compile it (say test.exw) to test.exe and then either rename the executable or move it to some directory where there is no test.exw |
|||
{{out}} |
|||
<pre> |
|||
puts(1,get_text(command_line()[2])) |
|||
</pre> |
|||
Interpreted or compiled - latter only works while executable and source are still in the same directory, and not renamed. |
|||
<lang Phix>puts(1,get_text(substitute(command_line()[2],".exe",".exw")))</lang> |
<lang Phix>puts(1,get_text(substitute(command_line()[2],".exe",".exw")))</lang> |
||
{{out}} |
{{out}} |
||
Line 72: | Line 77: | ||
>p test ;; or p -c test |
>p test ;; or p -c test |
||
puts(1,get_text(substitute(command_line()[2],".exe",".exw"))) |
puts(1,get_text(substitute(command_line()[2],".exe",".exw"))) |
||
</pre> |
|||
Alternative - see the docs (ie phix.chm) for an explanation of the ("") and [1][2]: |
|||
<lang Phix>?get_text(include_path("")&include_files()[1][2])</lang> |
|||
{{out}} |
|||
<pre> |
|||
"?get_text(include_path("")&include_files()[1][2])" |
|||
</pre> |
</pre> |
||