Brian Volk wrote:
I have a .txt file which contains item numbers like so..
1234
1245
1278
1240
etc.
I am trying to print the entire url, $main_url after substituting the item
number in the .txt file... I'm having a little trouble w/ my loop... Below
is the script. #!/usr/bin/perl -w
use strict;
my $kc_item = "E:/perl/kc_num.txt";
open (KCITEM, $kc_item) or die "can't open $kc_item: $!";
# my $new_file = "> E:/perl/kc_urls.txt";
my $main_url = "
<http://www.kcprofessional.com/us/product-details.asp?search=v1&searchtext=1
804&x=0&y=0>
http://www.kcprofessional.com/us/product-details.asp?search=v1&searchtext=18
04&x=0&y=0";
while (<KCITEM>) {

You want to remove the newline character:

    chomp;

  print "$main_url\n";
  s/1804/KCITEM/ and print "$main_url\n";

You probably mean:

    $main_url =~ s/1804/$_/ and print "$main_url\n";

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to