Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8421945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:17:38+00:00 2026-06-10T03:17:38+00:00

I just started on learning perl, and in the sample code given by my

  • 0

I just started on learning perl, and in the sample code given by my book there is this line:

#!/usr/bin/perl
@lines = `perldoc -u -f atan2`;
foreach (@lines) {
s/\w<([^>]+)>/\U$1/g;
print;
}

the code works, that’s not the problem. Also by observing the input and output I know that this line:

s/\w<([^>]+)>/\U$1/g;

does this

ATAN2 ARCTANGENT TAN TANGENT <--- X<atan2> X<arctangent> X<tan> X<tangent>

and this

MATH::TRIG::TAN <------- C<Math::Trig::tan>

My question is: where does the X and the C come from?


As an FYI: here is my output if I don’t use the code:

perldoc -u -f atan2
=over 8

=item atan2 Y,X
X<atan2> X<arctangent> X<tan> X<tangent>

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])  }

The return value for C<atan2(0,0)> is implementation-defined; consult
your atan2(3) manpage for more information.

=back

And here is the complete output from the code:

[/cygdrive/c/Users/Documents/learn_perl]$ ./hello_world.pl 
=over 8

=item atan2 Y,X
ATAN2 ARCTANGENT TAN TANGENT

Returns the arctangent of Y/X in the range -PI to PI.

For the tangent operation, you may use the MATH::TRIG::TAN
function, or use the familiar relation:

    sub tan { sin($_[0]) / cos($_[0])  }

The return value for ATAN2(0,0) is implementation-defined; consult
your atan2(3) manpage for more information.

=back
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:17:40+00:00Added an answer on June 10, 2026 at 3:17 am

    The substitution regex

    s/\w<([^>]+)>/\U$1/g;
    

    Finds an alphanumeric character (X and C in the sample text), followed by <, captures any characters that are not >, followed by a >. Then it puts the captured string back, with the escape sequence \U which turns it into upper case.

    My question is: where does the X and the C come from?

    They were already in the perldoc text. They were however removed by the substitution regex. Perhaps you got input and output confused.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just started learning PySide and is having problem with QTimer I have this #!/usr/bin/python
I just started learning C but I don't understand this part of the code.
I've just started learning perl and I am am confused by this exercise (from
Just started learning Groovy, got the PragProg book Programming Groovy and had a problem
I just started learning RoR. This is my /app/trip_controller.rb file class TripController < ApplicationController
I just started learning C++ couple of weeks ago. So now I have this
Just started learning Haskell. I have an empty source file with this inside: pe
I just started learning some ruby, and I want to do something like this:
I just started learning swing, and couldn't find any clear instructions for this: I'd
I have just started learning Perl scripting language and have a question. In Perl,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.