#!/usr/bin/perl
open (example, "tablemetadata.txt") or die ("Could not open file. <br> $!");
while ($text=<example>)
{
chomp($text);
next if $text =~ /^\s*$/;
$text=~s/^\s+//;
$text=~ s/^\s+//;
print "<< $text >>$/";
}
close (example);
I'm new to perl. I would like to read a text file and enclose each line in brackets (just for the heck of it). I can read the file and add stuff to the beginning of each line, but I can't seem to get stuff added to the end of each line.
For example,
this is a line of text
I want
<< this is...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.