Тема: Perl , post
Показать сообщение отдельно

  #21  
Старый 22.02.2008, 22:33
bul.666
Banned
Регистрация: 06.06.2006
Сообщений: 944
С нами: 10489346

Репутация: 1403


По умолчанию

Цитата:
^^
C:\Perl\bin>perl scr/reg.pl
Bareword found where operator expected at scr/reg.pl line 6, near "m/<A>(.+)<(ba
ckslash)/A"
Unquoted string "backslash" may clash with future reserved word at scr/reg.pl li
ne 8.
syntax error at scr/reg.pl line 6, near "m/<A>(.+)<(backslash)/A"
Search pattern not terminated at scr/reg.pl line 8.

Цитата:
(backslash)
А не легче экранировать?
<\/DIV>

Цитата:
my $s='<html> <head> <title>PERL regexp</title> </head>
<body> <h1>File where I serach text</h1>
<DIV>I NEED THIS TEXT</DIV>
</body>
</html>';
print "Result : $1 " if $s=~/<DIV>(.+)<\/DIV>/;
Более ч0ткий пример (c) demonoid

Последний раз редактировалось bul.666; 22.02.2008 в 22:39..
 
Ответить с цитированием