当我运行下面的脚本时,我得到
$VAR1 = [
'ok0.ok]][[file:ok1.ok',
undef,
undef,
'ok2.ok|dgdfg]][[file:ok3.ok',
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef
];
我希望的地方ok0.ok ok1.ok ok2.ok ok3.ok
,理想情况下也是ok4.ok ok5.ok ok6.ok ok7.ok
问题
谁能看到我做错了什么?
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my $html = "sdfgdfg[[file:ok0.ok]][[file:ok1.ok ]] [[file:ok2.ok|dgdfg]][[file:ok3.ok |dfgdfgg]] [[media:ok4.ok]] [[media:ok5.ok ]] [[media:ok6.ok|dgdfg]] [[media:ok7.ok |dfgdfgg]]ggg";
my @seen = ($html =~ /file:(.*?) |\||\]/g);
print Dumper \@seen;