I'm trying to write a program that turns tabs into spaces but it doesn't work.
Code:
#!/usr/bin/perl
$argc = 0;
foreach (@ARGV)
{
++$argc;
}
if ($argc ne 1)
{
die "You either have none or not enough arguments.\n"
}
my $tab = "\t";
my $spaces = " ";
open FILE, $ARGV[1];
@LINES = <FILE>;
close FILE;
foreach $lines (@LINES)
{
$lines =~ s/$tab/$spaces/gx;
}
print @LINES;