행복아울렛
My first perl program. 본문
This is my first perl program.
--------------------------------
#!/usr/bin/perl
#2008.7.8 William Seo
#This is my first perl program to make a perl script file.
#You can use this if you want a new perl script.
sub checkArg
{
if( $#ARGV+1 == 1)
{
1;
}
}
checkArg() or die "np\nUsage:np scriptName";
#make a date string
$DATE=`date +20%y.%m.%d`;
#remove trailing new line character
chomp($DATE);
open INPUT, ">$ARGV[$#ARGV]" or die "File Open Error";
print INPUT "#!/usr/bin/perl\n";
#add some strings
print INPUT "#$DATE William Seo\n\n";
#change mode for executable
chmod(0755,$ARGV[$#ARGV]);
close INPUT;
print $ARGV[$#ARGV]." was created!\n";
---------------------------------------------------------------------
Comments