Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

using print

Status
Not open for further replies.

netrookie

Technical User
Jul 6, 2003
29
US
Guys, I'm stuck trying to format my output using "print". I basically want to keep the string as one line, but it breaks off at the point where I'm calling the scalar variable.

Here is the sample output.
Code:
create table urldb3.Heartbeat
 select * from urldb2.Heartbeat
 limit 10;

Here is my code:
Code:
foreach my $tblist (@tblist)
{
   print  MYOUTFILE "create table $dbtgt.$tblist select * from $dbsrc.$tblist limit 10;\n";
};

Desired format:
Code:
create table urldb3.Heartbeat select * from urldb2.Heartbeat limit 10;









 
chomp $tblist;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Sweet :-> That did the trick. Thanks!

for reference:
Code:
foreach my $tblist (@tblist)
{
   chomp $tblist;
   print  MYOUTFILE "create table $dbtgt.$tblist select * from $dbsrc.$tblist limit 10;\n";
};

 
probably more efficient to just
chomp @tblist;
instead of each $tblist;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[noevil]
Travis - Those who say it cannot be done are usually interrupted by someone else doing it; Give the wrong symptoms, get the wrong solutions;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top