On Jan 9, Yacketta, Ronald said: >I see that :) but not sure how to pull just the first line from the file >WITHOUT closing it and skipping to the next...
Oh. Well, what are you trying to do? Change the first line of a set of files? >local @ARGV = @sleepystart; >while (<>) { > $line = $_; # ?????? > s/\Q$line\E/$db_name/g; > print; >} If you wish to edit the files in-place, you'll also need to use $^I here. { local ($^I, @ARGV) = (".bak", @sleepystart); while (<>) { $_ = "$db_name\n" if $. == 1; print; close ARGV if eof; } } That changes the first line of each file to $db_name's value (plus a newline!), and then prints the file back to itself (a backup copy is stored with extension .bak). -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]