- 论坛徽章:
- 0
|
本帖最后由 hyoryeo 于 2010-06-30 14:44 编辑
- [root@gimei-test bin]# more tvinfo.perldata
- $VAR1 = {
- 'husband' => 'fred',
- 'pal' => 'barney'
- };
复制代码 test1- #!/usr/bin/perl
- #use strict;
- use warnings;
- use Data::Dumper;
- open (IN, "<tvinfo.perldata");
- undef $/;
- my $TV = eval <IN>;
- print $TV->{husband};
复制代码 [root@gimei-test bin]# perl testing_data_dumper.pl
fred
test2- #!/usr/bin/perl
- use strict;
- use warnings;
- use Data::Dumper;
- open (IN, "<tvinfo.perldata");
- undef $/;
- my $TV = eval <IN>;
- print $TV->{husband};
复制代码 [root@gimei-test bin]# perl testing_data_dumper.pl
Use of uninitialized value in print at testing_data_dumper.pl line 21, <IN> chunk 1.
请问各位大大,是我的用法有错吗??为什么用use strict;或者不用use strict;有区别??请指点迷津... |
|