2009/11/13 Subhashini <subhashinibasavar...@gmail.com>:
> hello dermot,

Hello

You should direct you replies to the mailing list. There are far
better programmers out there then me.



> I am doing a coversion on french to english words.I have installed the
> dictionary and i could use it on my command prompt using the following
> command.
>
> dict -d fd-fra-eng bonjour   This is a french to english coversion
>
>
> dict -d fd-eng-fra potato    This is an english to french coversion
>
>
> I want to run this using perl and display the translation onto an output
> file

I could give you the quick and dirty answer but 1) you'd not learn
anything apart from that 2) I'd be flamed if I let didn't make a few
comment about your script.

> Here is my piece of code
>
> #!/usr/bin/perl

It's always a good idea to enable warning and the strict pragam. This
give you valuable feedback about what's not right with your script.

#!/usr/bin/perl

use warnings;
use strict;


> print "ENTER THE WORD IN ENGLISH";
> print "\n";
> $english=<STDIN>;

You will have a trailing new line from that <STDIN>. You want to get
rid of that because you dict programme is not going to store words
with a "\n" at the end of each term and hence the lookup will fail.
Use chomp() to remove these new line characters.

my $english = chomp(<STDIN>);

> print "word =====";
> print "$english";
> print "\n";
> print "##############################   ENGLISH  TO  FRENCH TRANSLATION
> #############################";
> print "\n";


> system("dict -d fd-eng-fra $english");


Let's look at what the docs say here:
[Quote][1]
  1.  system("prog args 1>tmpfile 2>&1");
[/Quote]

Can you alter your script to look like the example above?

system("dict -d fd-eng-fra $english");


Let see how you do? Good luck.
Dp.



[1] Borrowed from perlfaq8. This command sends both standard out and
standard error to the temporary file.

--
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