a grand renaming so that the most significant portion of the name comes first

This commit is contained in:
Dan Buch
2012-03-03 21:45:20 -05:00
parent c8b8078175
commit f4f448926d
1300 changed files with 0 additions and 234 deletions

View File

@@ -0,0 +1,22 @@
#!/usr/bin/env perl
use strict;
use warnings;
my @inlines = ();
my $i = 0;
for ($i = 0; $i < 3; $i++) {
print "input please: ";
my $inline = <STDIN>;
$inline =~ s/\s*$//;
$inlines[$i] = $inline;
}
print "You said:\n";
print join("|", $inlines[0], $inlines[1], $inlines[2] . "\n");
1;
__END__

View File

@@ -0,0 +1,11 @@
#!/usr/bin/env perl
use strict;
use warnings;
foreach my $inline (@ARGV) {
print $inline . "\n";
}
1;
__END__

View File

@@ -0,0 +1,33 @@
#!/usr/bin/env perl
use strict;
use warnings;
use IO::File;
use File::Basename;
my $script = basename($0);
my $USAGE = <<USAGE
Usage: $script <infile>
USAGE
;
if (!defined $ARGV[0]) {
die $USAGE;
}
my $infile = $ARGV[0];
open(DAT, $infile) or die "$infile: $!";
my @cleaned = ();
foreach my $line (<DAT>) {
$line =~ s/\s*$//;
$cleaned[++$#cleaned] = $line;
}
print join("|", @cleaned) . "\n";
close(DAT);
1;
__END__

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Math::Complex;
use File::Basename;
my $prog = basename($0);
my $USAGE = <<USAGE
Usage: $prog <a> <b> <c>
USAGE
;
sub quad {
my ($a, $b, $c) = @_;
my $positive = (
($b * -1) - sqrt(($b ** 2) - (4 * ($a * $c))) / (2 * $a)
);
my $negative = (
($b * -1) + sqrt(($b ** 2) - (4 * ($a * $c))) / (2 * $a)
);
return ($positive, $negative);
}
foreach my $arg (@ARGV) {
if (($arg eq "-h") || ($arg eq "--help")) {
die $USAGE;
}
}
my ($a, $b, $c) = @ARGV;
if (!defined $a) {
print '$a = ';
$a = <STDIN>;
}
if (!defined $b) {
print '$b = ';
$b = <STDIN>;
}
if (!defined $c) {
print '$c = ';
$c = <STDIN>;
}
my @result = quad($a, $b, $c);
printf("%s, %s\n", $result[0], $result[1]);
1;
__END__