Let me start of with a smaller question. . ..

How do you get rid of returns? 
I known chomp gets rid of new lines, but I don't know how to get rid of returns.
My code accepting data from the user. I just need to start by filtering out \n's and
\r's

I tried the code (snippet below), but there seems to be 2 problems:
1) my code ignored the if statement 
2)If my $line did have a return, I wouldn't know now to remove it.
Could I say something like

if (/\r/) {  
    $line = grep(/[^\r]/,$line) 


EXISTING SNIPPET OF CODE
-------------------------
open(SOURCE, $source_file) || die "Cannot open \"$source_file\: $!";
my $line;
while ($line = <SOURCE>) {
    if(/\n) {
        chomp; 
    if (/\r/) {
        print "This line has a \\r\n";

 }
} 


Thanks!
-T

Reply via email to