Scripting Help (was Qmail Toaster Help / Perl Help)

Eric "Shubes" plug at shubes.net
Mon Dec 18 12:21:55 MST 2006


Gilbert,
Having everything in a single executable is a good reason to use perl.

Generally speaking, use whatever works, which is typically whatever you're
most comfortable with. I only used shell because that's what I could do off
the top of my head as an example.

For this specific application, I don't know if decrypting the passwords
would be possible with bash or not. I'm guessing that perl is a good choice
for that purpose.

As a general rule, I try to use the highest 'level' language that can get
the job done, within performance limits of course. KISS rules.

Gilbert T. Gutierrez, Jr. wrote:
> Eric,
> Thanks for the help.  I am debating which way to go, perl or shell.  Here is
> the perl script I wrote using "Empty's" line of perl.  I am leaning towards
> perl so that I can combine my other perl scripts and make everything one
> execution.
> 
> Gilbert
> 
> #!/usr/bin/perl
> # This is a script takes a list of email addresses and
> # passwords and formats it into a csv file of
> # username, domain, password
> 
> # Open file with usernames and passwords
> open(REGFILE,"registryfile.txt") || die "Cannot open registryfile.txt\n";
> 
> # File to store comma separated values
> open(NCSV,">encrypt.csv") || die "Cannot open encrypt.csv!\n";
> 
> @myreg = <REGFILE>;
> 
> foreach $listitem ( @myreg ) {
>   if (grep(/\.net/, $listitem) || grep(/.com/, $listitem)
>      || grep(/.org/, $listitem)) {
>      $listitem =~ s/\n/,/;
>      $listitem =~ s/\@/,/;
>   }
>   print NCSV $listitem;
> }
> 
> close (NCSV);
> close (REGFILE);
> 
> ---


-- 
-Eric 'shubes'


More information about the PLUG-discuss mailing list