I want to write a program however I'm having a little difficulty.
print "Fahrenheit (F) or Celsius (C)?";
$blah=<STDIN>;
If $blah=F {
print "F"};
else {
print "C"};
How do I make the If statement work? I'm trying to write a chemistry
program that will differentiate something like hydrogen sulfate and
hydrogen sulfite, break the "hydrogen sulfate" into "hydrogen" and
"sulfate" any ideas? Thanks |
Clarification of Question by
henagerj-ga
on
27 Jun 2005 18:48 PDT
Ok, I got that part down, now how do I make a standalone Perl
executable? Not for servers or anything, just something I could easily
distribute working code with, thanks.
|
Request for Question Clarification by
mathtalk-ga
on
28 Jun 2005 18:28 PDT
The usual implementations of Perl are for interpreting scripts. On
platforms where scripting languages like Perl are supported "out of
the box", eg. Linux, Solaris, etc., you would simply need to add a
first line to a text file that indicates it is to be interpreted as
Perl and set permissions on the file to make it executable. It would
remain an interpreted text file.
If you are thinking about distributing the file, perhaps as a binary,
on platforms that lack "native" support for a Perl interpreter, then
we need to look at more complicated (less easily accomplished) steps
for distributing your code.
regards, mathtalk-ga
|
Clarification of Question by
henagerj-ga
on
29 Jun 2005 17:57 PDT
Where can I find out about changing my script to binary? How would
distribution become more complicated?
|
Request for Question Clarification by
mathtalk-ga
on
29 Jun 2005 18:02 PDT
Are we talking about a Windows platform?
regards, mathtalk-ga
|
Clarification of Question by
henagerj-ga
on
30 Jun 2005 10:21 PDT
Yes, I did a little research on converting perl script to binary, only
confused myself. Would it be easier to host a program on my site? Not
sure how to do that either.
|
Request for Question Clarification by
mathtalk-ga
on
30 Jun 2005 19:20 PDT
Hi, henagerj-ga:
I'm wondering if by hosting "a program on my site" you mean to set up
a Web page where a user could use your program interactively.
Certainly this is a possibility. Many interactive Web pages are "CGI"
applications, a significant portion of these are written in Perl, and
a number of Google Answers Researchers are quite proficient at doing
these sorts of programs (I don't consider myself in their league!).
The Question seems to have moved in several directions since the
original post. If I wanted to build a small standalone program as a
binary Windows executable, with the intention of giving it out freely
to users who wanted it, Perl as the implementation language would have
few advantages and several big disadvantages.
IndigoStar, one of the implementers of a Perl interpreter for Windows
platforms, has a commercial product called Perl2exe that would create
a standalone executable, versions either for Windows or Unix, from a
Perl script:
[Perl2exe]
http://www.indigostar.com/perl2exe.htm
On the other hand, creating a Web page on your server to be available
to Internet users (or perhaps to users on a local area network) is an
application well suited to Perl. I'd like to know more about what you
are trying to accomplish to make a firm recommendation.
regards, mathtalk-ga
|
Clarification of Question by
henagerj-ga
on
01 Jul 2005 07:06 PDT
ultimately i would like to distribute programs that i have and will
write related to classes to a small group of students, about 45 of
them. I would like to distribute it as a .exe file if at all possible,
but if not i would like to put it on my site, qwertypoiuy.com, I have
no experience with .CGI extensions whatsoever, and i'm very new to
perl, i have a 24 hour learning book and have only looked through the
first 4 hours, just what i need to write a few programs related to
chemistry. the only problem is distributing the program without having
the users have to download a perl interpreter or something.
|
Request for Question Clarification by
mathtalk-ga
on
01 Jul 2005 10:53 PDT
The Perl interpreters are available for free (at least for
non-commercial use, as I believe your example would fall into). The
Perl2exe product cited above is not free, but the cost would be only
to you, as you could then (according to the claims made by the vendor,
which I have no reason to doubt) distribute the executables to
students or whomever without the need for them to separately install
the interpreter.
Note that the Perl2exe product "piggybacks" on an interpreter that you
would have installed on your machine. See the site for the list of
Windows Perl interpreters which the Perl2exe product supports (the
list includes IndigoState's interpreter, IndigoPerl, as well as their
commercial competitor ActiveState's interpreter, ActivePerl). Again,
you'd need a compatible version on your "development" machine, but the
resulting standalone executables should work on any 32-bit Windows
machine.
If you feel that this is satisfactory, I'll post the information as
the final Answer.
regards, mathtalk-ga
|
Clarification of Question by
henagerj-ga
on
01 Jul 2005 19:05 PDT
that'll be fine, however do you know of anything free i could use? Or
some information on how i can make it available on a website? thanks
|
Request for Question Clarification by
mathtalk-ga
on
09 Jul 2005 11:47 PDT
Hi, henagerj-ga:
There are many free programming tools that you could use to create
simple "command line" stand-alone executables and to distribute these
to Windows users, however I don't know of a way to do this for the
Perl programming language.
If you are a beginning programmer in Perl, perhaps the issue should be
raised of whether this is the most appropriate language for what you
want to do. Perl is very flexible, but I dare say most people would
not consider it an especially easy language to learn (and certainly
not to master).
Are there perhaps some programming languages that you already know?
regards, mathtalk-ga
|
Clarification of Question by
henagerj-ga
on
09 Jul 2005 15:10 PDT
PERL is the only one i know. I don't know any of the shortcuts I
should, like using the 'for' command instead of a
5=A
label ASDF
print A
A++
goto ZXCV if A=10
else goto ASDF
.
So I'm not sure if i should say that I even 'know' the language, I've
only scanned the first few chapters of a book. I decided on perl
because others said it was a powerful language, by which i believe
they meant I could continue to learn it and gain more, and because it
was the only language i could find in which i could formulate programs
in my head, not including the first line. C++ was too dificult for me,
it seemed I always needed supplementary files when compiling, and java
was too difficult for me.
Perhaps there are translators out there that you know of? Or another
language which I could eventually use to make graphics with? Just post
your next comment as an answer, you've spent enough time on this
problem.
|