Technology, Web & Business Forum

You are here: Technology, Web & Business Forum : Web Development : Programming : perl programming???


Welcome to the Technology, Web & Business Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.


Programming Discuss programming languages such as .NET, PHP, PERL, ASP, ColdFusion, C++


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-14-2008
Junior Member
 
Join Date: May 2008
Posts: 3
Default perl programming???

while (<IN2>)
{
if ($_ =~ /xml version/)
{
print $Count++, " ", $_;
print OUT $_;
}
else
{
exit
}

I have this above program where the $_ searh for the "xml version". But I wanted it to change and look for <?xml version="1.0" the problem is it gives out an error when searching for <?xml version="1.0". Please help???
__________________
Powered by Yahoo! Answers
Reply With Quote
  #2 (permalink)  
Old 05-14-2008
Junior Member
 
Join Date: May 2008
Posts: 2
Default

the question mark is a reserved wildcard repetition signal for regular expressions. Right now it is telling to look for either 0 or 1 of the less than (<) symbol, then look for xml... it doesnt look for the question mark. you need to escape it. Perhaps you will need to escape the quotation marks as well? I'm not sure off the top of my head if it will give you an error as well. Start with the question mark for sure:

($_ =~ /<\?xml version="1.0"/)
__________________
Powered by Yahoo! Answers
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 09:55 AM.