Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^5: How to avoid an alphabet and integer next to it in a string?

by piscean (Acolyte)
on Mar 21, 2014 at 18:38 UTC ( #1079329=note: print w/ replies, xml ) Need Help??


in reply to Re^4: How to avoid an alphabet and integer next to it in a string?
in thread How to avoid an alphabet and integer next to it in a string?

The first code says Forbidden chars again. Second one, Unicode -y approach? I am not familiar with that. Could you help me? How should the input be in an unicode -y approach?


Comment on Re^5: How to avoid an alphabet and integer next to it in a string?
Re^6: How to avoid an alphabet and integer next to it in a string?
by runrig (Abbot) on Mar 21, 2014 at 18:45 UTC
    The first code says Forbidden chars again.
    So show the input and output, quit making us guess (and when I say 'output' I mean the new string, not the number you're trying to calculate).

    As far as which approach, don't worry about it. Just pick one (as long as it works).

      Input was
      my $molform = <STDIN>;
      C6H9 and Output was:
      ------Please enter single letter elements in caps only------ Enter the molecular formula of the compound = C6H9 Forbidden chars The molecular weight of the above compound is =
        chomp(my $molform = <STDIN>);
        Think about it. How does that help (read again what output I asked for)? When you're trying to determine input and output to something...just print the something...
        my $molform = <STDIN>; print "Molform before: [$molform]\n"; s/\s+$//, s/H(?![a-z])\d*//g for $molform; print "Molform after: [$molform]\n";
        Although hazylife may have nailed the problem...you need to learn how to provide useful debugging information.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1079329]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-09-20 06:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (155 votes), past polls