in reply to Re: help in ruby code to perl
in thread help in ruby code to perl
While it probably doesn't matter in this case (since the whole file is being read at once), '<:raw' prevents a buffering layer from being added. You want
oropen(my $fh, '<:perlio:raw', $qfn);
open(my $fh, '<', $qfn); binmode($fh);
Same goes for '>:raw'.
The usual idiom is
rather thanlocal $/; my $str = <$FI>;
read $FI, my $str, -s $FI;
A regex (/(.{40} EMF.*)/s) would be a bit simpler than index+pos+substr and more idiomatic. It could be a bit slower, but probably not since it's optimised to look for " EMF" first.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: help in ruby code to perl
by jwkrahn (Abbot) on Sep 20, 2009 at 17:30 UTC | |
by ikegami (Patriarch) on Sep 20, 2009 at 17:51 UTC | |
by jwkrahn (Abbot) on Sep 20, 2009 at 18:44 UTC | |
by ikegami (Patriarch) on Sep 20, 2009 at 18:55 UTC |