At 01.32 98.02.03, Emmanuel. M. Decarie wrote: >Is it appropriate for beginners to ask question to this list? I know a little >bit of regex via Nisus Writer and Frontier, I'm currently reading "Mastering >Regular Expression" from E.F. Friedl and want to learn both Perl and MacPerl. Beginners are absolutely welcome, although this list is primarily for MacPerl-specific issues, and not Perl issues in general. i.e., if the answer is the same for both Perl and MacPerl, then the question is at least a little bit off-topic (and perhaps a lot :). >print "Enter a temp in Celsius:\n; >$Celsius=<STDIN>; >chop ($Celsius); > >if ($Celsius =~m/^[0-9]+$/) { > $far=($Celsius * 9 /5) +32; > print "$Celsius C = $far F\n"; >} else { > print "Expecting a number, so don't understand \"$Celsius\".\n; >} > >Then he say to "put this program into the file c2f" and run it like this: > >% perl -w c2f > >My question is: in what kind of MarPerl file shoud I save this code, and how >can I invoque the file/program from MacPerl. You can type the code directly into a MacPerl window and save it wherever you want. There are three issues here: 1.) Invoking the script. In the MacPerl application you do not call scripts from a command line, but from the "Run" menu item in the "Script" menu. 2.) MacPerl likes to have "#!/usr/bin/perl" with any command line options on that line as the first line of your script. Some command line options don't work there, but most do. For -w, alternatively, you can use the "Compiler Warnings" menu item under the "Script" menu. 3.) STDIN works on MacPerl similarly to Unix perl under a shell. When asked for, the MacPerl window will print to STDOUT and read from STDIN, you just type in the window and hit return. Also note that you are missing two ending " marks, on lines 1 and 9. >I look around the documentation (Silicot Primer, MacPerl FAQ) but I'm totally >at lost. These are a bit out of date still, I think, though they have some good info. You might want to look at the draft chapters of our upcoming book on MacPerl (URL below). HTH, -- Chris Nandor mailto:pudge@pobox.com http://pudge.net/ %PGPKey=('B76E72AD',[1024,'0824 090B CE73 CA10 1FF7 7F13 8180 B6B6']) #== New Book: MacPerl: Programming for the Rest of Us ==# #== Publishing Date: Early 1998. http://www.ptf.com/macperl/ ==# ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch