Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想从 bin 文件中读取一个字符串(字符串从固定偏移量开始并以空值结尾)。
如何在 Perl 脚本中执行此操作?
seek必要时到正确的位置,然后使用:
seek
my $str; { local $/ = "\0"; $str = <$fh>; } die "Premature EOF" if !defined($str) || $str !~ /\0\z/; chop($str);