Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

String manipulation & file I/O

Name: Anonymous 2007-05-13 1:42 ID:a16QPoC4

I have a text file full of thousands of md5 hashes from around the interwebs but they are seperated with newlines.

I need to open the txt hash file, and write to another file but replacing every newline with nothing.

Possible languages: Perl, C++ or Visual Basic 6.

Name: Anonymous 2007-05-13 16:37 ID:FjXW1svk

perl, syntax ./program.pl inputfile


#!/usr/bin/env perl
use strict;
use warnings;

open my $out_h, ">", "/tmp/output.txt"
        or die $!;

while (<>) {
        s/\n//g; # replace newline
        print {$out_h} $_;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List