Как в перл пропускать строки
Как в перле. пропустить строки при считывание файла. которые содержат "download". Я так понимаю используется next, но как сделать правильно?
while (<F>){
next......
}
1 ответ
Решение
При переборе строк воспользуйся регулярными выражением:
#!/usr/bin/perl
$bar = "This is foo and again foo";
if ($bar =~ /foo/) {
print "First time is matching\n";
} else {
print "First time is not matching\n";
}
$bar = "foo";
if ($bar =~ /foo/) {
print "Second time is matching\n";
} else {
print "Second time is not matching\n";
}
Взято отсюда: https://www.tutorialspoint.com/perl/perl_regular_expressions.htm