我有两个这样的 Perl 文件。使用 perl5db.pl 我试图在 file2.pl 的第 7 行设置一个断点,但遗憾的是它不允许我这样做。我寻找答案,发现我可以使用模块,但 file2.pl 没有使用模块。我能做些什么?
#file.pl is
#!/usr/bin/perl
use strict;
use warnings;
require "file2.pl";
# This file is a test file to run the debugger on.
hello();
my $var = 1;
my $var2 = 2;
makeEqual();
sub main {
if($var == $var2){
print "they are equal\n";
}
else {
print "they are not equal\n";
makeEqual();
}
my $value =2;
print "the value is $value\n";
}
sub makeEqual {
$var = $var2;
my $str = " this is crazy";
$str =~ s/\s+/ /g;
print "$str is done \n";
}
main();
#file2.pl is
#!/usr/bin/perl
use strict;
use warnings;
sub hello {
print "I am in hello";
}
1;