Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Amazed looking at her code and the error, neophyte ventures to ask:
The following code is part of a program that will be used to find given building stuff (big tubes, in this case) according to input sizes.
I'm using a given formula to calculate b for a given tube with the input of a.
use Math::Trig; use diagnostics; my $a = 3; # user input my $r1 = 3.05; # radius 1 of elliptical tube my $r2 = 3.95; # radius 2 of elliptical tube my $w2 = 82.6; # angle 2 my $w_beta1 = asin($a / (2 * $r1)); my $b = $r1 * ( cos($w_beta1) - (cos($w2 / 2) ) + $r2 * cos($w2 / 2); print $b;

When I execute this code I get a syntax error in the line where $b is defined. No more information, so when I execute this with use diagnostics I get Uncaught exception from user code: syntax error at noname.pl line 8, near ");"
which really doesn't help me. I already looked for missing punctuation and unpaired brackets, but I cannot find anything.
Please tell me what's wrong with that piece of code.

neophyte Niederrhein.pm


In reply to trigonometric functions give an uncaught user exception by neophyte

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-03-28 18:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found