Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^3: By the shine on my bald pate, I dislike this encoding stuff

by poj (Abbot)
on Mar 04, 2018 at 09:01 UTC ( [id://1210305]=note: print w/replies, xml ) Need Help??


in reply to Re^2: By the shine on my bald pate, I dislike this encoding stuff
in thread By the shine on my bald pate, I dislike this encoding stuff

Empty string

All the content is read into @LINES so $filedata is empty

my(@LINES) = <ORDERFILE>;
my $filedata = <ORDERFILE>;

Maybe try

my @LINES = <ORDERFILE>;
my $filedata = join '',@LINES;

or just

open ORDERFILE, '<', $emailfile or die "$emailfile: $!";
my $filedata = do { local $/; <ORDERFILE> };
close ORDERFILE;
poj

Replies are listed 'Best First'.
Re^4: By the shine on my bald pate, I dislike this encoding stuff
by jfrm (Monk) on Mar 04, 2018 at 11:23 UTC

    Thank you. I had no idea. That does work for the files that are ANSI. Most bizarrely,

    my @LINES = <ORDERFILE>; my $filedata = join '',@LINES;

    works but the following does not + I get loads of warnings: "utf8 "\xA3" does not map to Unicode"

    my $filedata = <ORDERFILE>;
      my $filedata = <ORDERFILE>;

      That only reads the first line of the file.

      poj

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-16 10:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found