0
と2番目のインスタンスを解析I為替レートを取得するコードを持っている:Perlが正規表現
#!/usr/bin/perl
use warnings;
use strict;
use LWP::Simple;
use POSIX qw(strftime);
use Math::Round;
use CGI qw(header start_html end_html);
use DBI;
sub isfloat {
my $val = shift;
return $val =~ m/^\d+.\d+$/;
}
.....
my $content = get('URL PAGE');
$content =~ /\s+(\d,\d{4})/gi;
my $dolar = $1;
$dolar =~ s/\,/./g;
if (!isfloat($dolar)) {
error("Error USD!");
}
どのように第二のインスタンス/ \ S +(\ D、\ D {4})/ GIをつかむことができます?
私はこのようなPerlのクックブックから溶液試み:
$content =~ /(?:\s+(\d,\d{4})) {2} \s+(\d,\d{4})/i;
を私はエラーを持っている:
Use of uninitialized value $val in pattern match (m//)
Use of uninitialized value $dolar in substitution (s///)
ありがとうございました – Hesperson