[ create a new paste ] login | about

Link: http://codepad.org/0BvMdcrN    [ raw code | output | fork ]

Perl, pasted on Dec 11:
#!/usr/bin/perl

if (@ARGV != 1) {
	print "usage ./catrev.pl file1";
	print "@ARGV";
	exit;
}

else {

	$file1 = pop(@ARGV);
	
	open(FILE1,$file1);
	
@array1 = <FILE1>;

foreach (@array1) {
	$each = reverse($_);
	print "$each\n"

}

print "what would you like your file name to be?\n";
$filename = <STDIN>;
chomp ($filename);

if (($filename == "") || ($filename == undef)) {
	print "enter some data!";
	exit;
}

else {
	sub hellofile {
print "$_[0] is the file to be written";

open (FILE, '> $_[0]') or die "cant create file";

close(FILE);
}

hellofile($filename);

}

} 


Output:
1
usage ./catrev.pl file1


Create a new paste based on this one


Comments: