Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

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.


Comment on Re: string gets front truncated
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (12)
As of 2014-07-28 18:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (205 votes), past polls