Hi All
Today I was trying to do some work with perl and needed to use a
function that would trim leading or trailing spaces from a string.
Looked on the web and found basicaly perl uses either chop or chomp each
with their own features.
When I tried to apply it to my $var it either returned zeros or blanks.
Finally I found what looks to be a regular expression replacement which
does what I want it to, but I would never think it (trimming) to be so
tricky. I though it was supposed to be "easy things easy..." <grin>
open(FILE,"F:\\test_db\\Admin\\MINIHI\\DEF\\prog_list.txt"|| die "cant
open file") ;
chomp(@tblname = <FILE>);
open (outfile, ">F:\\test_db\\Admin\\MINIHI\\DEF\\INSERTprog_list.sql"||
die "cant open file") ;
foreach $progid (@tblname) {
$progid =~ s/\s+$//;
print outfile ("insert into ... where program_id = '$progid'
and rownum <=300 ;\n") ;
print "insert into ... where program_id = '$progid' and rownum
<=300 ;\n" ;
}
close outfile ;
#### prog_list.txt example
name -space-space
name_address -tab-space
name_phone - somekind of whitespace
I did perldoc -q trim and nothing. Of course chop and chomp were there
but diddnt seem to work in a pinch (or I couldnt understand how to apply
the function in my case.
I am determined to learn perl and would greatly appreciate your kind
help and paitence
thanks
rob
--
Learned men are the cisterns of knowledge, not the fountainheads.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]