On 2/10/06, Avinash Sridhar <[EMAIL PROTECTED]> wrote:
> Hi Thanks for the reply. I managed to write and execute my perl program.
>
> Now my next question is , I am following the learning perl Llama book.
>
> There in Chapter 1, there is a function used whose output is
>
> perldoc -u -f atan2
>
> =over 8
>
> =item atan2 Y,X
>
> Returns the arctangent of Y/X in the range -PI to PI.
>
> For the tangent operation, you may use the C<Math::Trig::tan>
> function, or use the familiar relation:
>
>     sub tan { sin($_[0]) / cos($_[0])  }
>
> =back
>
>
> for this script, they said there should be a different output for this
> program as opposed to the above output
>
> #!/usr/bin/perl
> @lines = 'perldoc -u -f atan2';
> foreach (@lines){
>     s/\w<([^>]+)>/\U$1/g;
>     print;
> }
>
> but all i get is
>
> perldoc -u -f atan2
>
> as the output.
>
> Am i missing something.
>
> thanks for looking in
sinp

It looks like your problem is

@lines = 'perldoc -u -f atan2';

it should be

@lines = `perldoc -u -f atan2`;

or

@lines = qx(perldoc -u -f atan2);


' is a single quote
` is a back quote (top left on most US keyboards)

Single quotes are for strings that should not be interpolated and
backquotes are for executing progams and capturing their output.  The
qx() operator is the generic form of ``.  You can learn more by typing

perldoc perlop

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to