Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: string gets front truncated

by goibhniu (Hermit)
on Jul 31, 2008 at 14:32 UTC ( [id://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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://701429]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-18 05:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found