我有以下代码来获取字符串中的子字符串,我正在使用正则表达式,但它们似乎无法正常工作。我该怎么做?
我有这个字符串:
vlex.es/jurisdictions/ES/search?textolibre=transacciones+banco+de+bogota&translated_textolibre=,300,220,00:00:38,2,0.00%,38.67%,€0.00
我想得到这个子字符串:
transacciones+banco+de+bogota
编码:
open my $info, $myfile or die "Could not open $myfile: $!";
while (my $line = <$info>) {
if ($line =~ m/textolibre=/) {
my $line =~ m/textolibre=(.*?)&translated/g;
print $1;
}
last if $. == 3521239;
}
close $info;
错误:
Use of uninitialized value $line in pattern match (m//) at classifier.pl line 10, <$info> line 20007.
Use of uninitialized value $1 in print at classifier.pl line 11, <$info> line 20007.