Re: Concatenation Question

From: Matt Garrish (matthew.garrish_at_sympatico.ca)
Date: 12/13/03


Date: Fri, 12 Dec 2003 22:50:17 -0500


"Chip" <ccarpenter@erols.com> wrote in message
news:jLvCb.456$xH2.307902@news1.news.adelphia.net...
> How can I add a ".jpg" extension to a string?
>
> I'm trying the following with 12345 as the input.
>
> #!/usr/bin/perl -w
> print "Please enter the item picture number to remove: ";
> my $number=<STDIN>;
> my $path=http://someplace.com/images/;
> my $ext=".jpg";
> my $picture="$path . $number . $ext";
> system rm $picture;
> print "$picture has been removed";
> __END__
>
> The output I'm hoping for is:
> http://someplace.com/images/12345.jpg has been removed
>
> What I get is:
> http://someplace.com/images/12345 has been removed
>

You couldn't possibly be getting that output based on the code above. For
one, it would never run because your $path variable is not quoted. Second,
when you read from STDIN, you also get the carriage return (\n). Third,
your extension is statically defined, so it must appear somewhere in your
output. And finally, you're not concatenating your string when you put it in
double quotes. Fixing your above code to run produces the following result:

http://someplace.com/images/ . 12345
 . .jpg has been removed

If you post your real code, someone might be able to help you.

Matt



Relevant Pages

  • Re: Convert Jpg
    ... So, if by 'convert to a Word doc', the intention ... Elements', I had hoped this might enable the conversion, but, the letters ... annotations and comments and combining all into one picture. ... You can import a .jpg into a Word document ...
    (microsoft.public.windowsxp.photos)
  • Re: Convert Jpg
    ... So, if by 'convert to a Word doc', the intention ... Elements', I had hoped this might enable the conversion, but, the letters ... annotations and comments and combining all into one picture. ... You can import a .jpg into a Word document ...
    (microsoft.public.windowsxp.photos)
  • Re: Jpg. where have you gone??
    ... With Windows Picture and Fax Viewer as indicated in my original post (or one ... of the many applications that will open jpg files.) ... file" dialogue box from the "file type" dropdown box. ...
    (microsoft.public.word.docmanagement)
  • Re: JPG Picture not Printing
    ... The picture displays in the Print ... "Mary Sauer" wrote: ... I now have the layout map printing albeit it ... the professional who creted the jpg to drastically reduce this size. ...
    (microsoft.public.publisher)
  • Re: Restore a picture
    ... rather than just changing the extension of the file from .bmp to .jpg you ... the file "changed it's stripes" from a jpg to bmp ... but at least I have the picture. ... >>> but B/W on the display background, under display properties) ...
    (microsoft.public.windowsxp.basics)