Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: how to get output

by dbashyam (Novice)
on Feb 18, 2014 at 05:38 UTC ( [id://1075264]=note: print w/replies, xml ) Need Help??


in reply to Re: how to get output
in thread how to get output

Hi, thanks for your reply. I did change now but still it prints output as '1', if you see my print statement I want to get the output as ORA-12505 in this scenario, but still not getting it right.

#!/usr/bin/perl my $org = ""; $Ora_code = 'Failed tthe following error: ORA-12505, TNS:listener does + not currently know of SID given in connect descriptor'; print $Ora_code; if ( my ($out) = $Ora_code =~ /ORA\-\d{5}/) { print "inside\n"; print $out; } else { print "(no match)\n"; }

Replies are listed 'Best First'.
Re^3: how to get output
by Kenosis (Priest) on Feb 18, 2014 at 05:47 UTC

    As Util correctly mentioned, you need to enclose what you want captured within parentheses, so your regex should be:

    /(ORA\-\d{5})/
Re^3: how to get output
by dbashyam (Novice) on Feb 18, 2014 at 05:44 UTC

    Thanks for your help. I got it now

Log In?
Username:
Password:

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

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

    No recent polls found