Wrote this 7 line simple perl script a while ago. I can’t believe how many times this has come in very handy. Simply create an ‘in.txt’ file and separate your variables with a newline. Adjust the print statement to reflect what you’ll want to do and pipe the output to a file. Perfect for creating other scripts.
#!/usr/bin/perl
#
# syntax: ./repeat >> out.txt
# create in.txt with a newline seperated list of variables
# output to a text file, use the print statement below to format
# your output.
#
$fname = “in.txt”;
open(FILE, $fname) || die(“Could not open $fname”);
while( <FILE> ) {
chomp($_);
print “Prepend Variable: $_ \n”;
}
close(FILE);