Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re: string gets front truncated

by goibhniu (Hermit)
on Jul 31, 2008 at 14:32 UTC ( #701429=note: print w/replies, xml ) Need Help??

in reply to string gets front truncated

Have you tried slurp mode? perlvar has this example:

open my $fh, "foo" or die $!; local $/; # enable localized slurp mode my $content = <$fh>; close $fh;

$/ is the input line separator. By having a local $/ undefined, the single line read, my $content = <$fh>; reads the whole file. If you're not doing anything to each line before putting it into your $wholeFile variable, then you may as well not think of the file as a set of lines and just read the whole file at once. You can see here how what you're trying to do might affect what kind of advice you might get.

If you still are thinking that you're missing the front of your file, then BrowserUK's explanation is probably the kind of thing to look for and you should prove it to yourself with graff's or ysth's approches of checking the length of your data or dumping to an output file.

update: I see where toolic pointed you to the slurp-mode solution in perlfaq5.

#my sig used to say 'I humbly seek wisdom. '. Now it says:
use strict;
use warnings;
I humbly seek wisdom.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://701429]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2017-02-27 17:05 GMT
Find Nodes?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?

    Results (389 votes). Check out past polls.