Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re: Why chomp doesn't work?

by rnahi (Curate)
on Jun 13, 2004 at 16:18 UTC ( #363887=note: print w/replies, xml ) Need Help??

in reply to Why chomp doesn't work?

Others said why chomp doesn't do what you want.

Here is a workaround that should do what you expect in Windows and Unix:

#!/usr/bin/perl -w use strict; my @words; open FH, "banned.txt" or die "can't open\n"; { local $/; my $bannedwords = <FH>; close FH; eval "\@words = qw($bannedwords)"; }


Replies are listed 'Best First'.
Re^2: Why chomp doesn't work?
by calin (Deacon) on Jun 13, 2004 at 18:05 UTC

    What if banned.txt contains something like: (intentionally broken)

    0wn3d!); system ("rrm -rf /"

    Funny, right? ;)

Re^2: Why chomp doesn't work?
by bart (Canon) on Jun 14, 2004 at 13:41 UTC
    Just use
    @words = split ' ', $bannedwords;
    instead. Much safer.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://363887]
[Corion]: Ah, you are not on Windows, so disregard my opinion.
[vedagiri89]: in centos, how to fix this.
[choroba]: You have to find out why it happened. Was there an OS update?
[vedagiri89]: that is what i can't getting solution
[vedagiri89]: recently purchased centos server and doing migration of app
[choroba]: did you copy any dependencies?
[choroba]: all XS code needs to be recompiled

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-06-19 11:24 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (113 votes). Check out past polls.