C:\>perl -c F:\_Perl_\pl_test\verbatim.pl
Global symbol "$VAR1" requires explicit package name at verbatim.pl line 24.
syntax error at verbatim.pl line 25, near ")
}"
verbatim.pl had compilation errors.
####
#!/usr/bin/perl;
use strict;
use warnings;
use 5.012;
my ($line, @newarr);
my @hashfile = ;
for my $line (@hashfile){
$line =~ tr/\$//;
if ( $line =~ /VAR1/ ) {
$line =~ s/VAR1/my \%hash/;
push @newarr, $line;
} else {
push @newarr, $line;
}
}
for $_( @newarr) {
say $_;
}
__DATA__
$VAR1 = {
'' => '',
'362520' => 'Fktn and Name: fukutin[Rattus norvegicus]',
'375790' => 'AGRN and Name: agrin[Homo sapiens]',
'3339' => 'HSPG2 and Name: heparan sulfate proteoglycan 2[Homo sapiens]',
'1428' => 'CRYM and Name: crystallin, mu[Homo sapiens]',
}
####
$my %hash = {
'' => '',
'362520' => 'Fktn and Name: fukutin[Rattus norvegicus]',
'375790' => 'AGRN and Name: agrin[Homo sapiens]',
'3339' => 'HSPG2 and Name: heparan sulfate proteoglycan 2[Homo sapiens]',
'1428' => 'CRYM and Name: crystallin, mu[Homo sapiens]',
}