Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Getting wierd results when looping through file contents

by mfriedman (Monk)
on Jun 26, 2002 at 16:16 UTC ( #177424=note: print w/replies, xml ) Need Help??


in reply to Getting wierd results when looping through file contents

Each line of the tables file does have a newline at the end, and that newline is at the end of each $table as you go through the loop. The reason the chomp didn't work is because it "returns the total number of characters removed from all its arguments." That's why you're getting a 1.

Thus, all you need to do is change your foreach loop to:

foreach $table (@tables) { chomp $table; print OUTFILE "BEGIN\n"; print OUTFILE " DBMS_REPCAT.CREATE_MASTER_REPOBJECT (\n"; print OUTFILE " gname => 'beastdb_mstr_grp',\n"; print OUTFILE " type => 'TABLE',\n"; print OUTFILE " oname => '$table',\n"; print OUTFILE " sname => '$schema',\n"; print OUTFILE " use_existing_object => TRUE,\n"; print OUTFILE " copy_rows => FALSE);\n"; print OUTFILE "END;\n"; print OUTFILE "/\n\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://177424]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2021-06-18 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (86 votes). Check out past polls.

    Notices?