Professional Web Applications Themes

unicode in Image::Magick (hex values and braces problem?) - PERL Miscellaneous

Eric Schwartz <emschwarpobox.com> wrote in comp.lang.perl.misc: > "Janek Schleicher" <bigjkamelfreund.de> writes: > > Bert Balcaen wrote at Mon, 23 Jun 2003 21:28:16 +0000: > > > my $text=""; > > > for(my $uni=25000;$uni<25100;$uni++) { > > > $text .= chr(hex($uni)); > > > $uni ++; > > > } > > > > That seems only to be a long version of > > > > my $text = join "" map chr, (0 .. 25_000); > > You appear to have misspelled > > my $text = join "", map chr, (25000 .. 25099); > > (Note comma after ...

  1. #1

    Default Re: unicode in Image::Magick (hex values and braces problem?)

    Eric Schwartz <emschwarpobox.com> wrote in comp.lang.perl.misc:
    > "Janek Schleicher" <bigjkamelfreund.de> writes:
    > > Bert Balcaen wrote at Mon, 23 Jun 2003 21:28:16 +0000:
    > > > my $text="";
    > > > for(my $uni=25000;$uni<25100;$uni++) {
    > > > $text .= chr(hex($uni));
    > > > $uni ++;
    > > > }
    > >
    > > That seems only to be a long version of
    > >
    > > my $text = join "" map chr, (0 .. 25_000);
    >
    > You appear to have misspelled
    >
    > my $text = join "", map chr, (25000 .. 25099);
    >
    > (Note comma after join's 1st arg, and correct indices.)
    To mimic the OP's code perfectly it should only use every other character.
    Note that $uni is incremented once in the loop control and once in the
    loop body.

    Anno

    Anno Siegel Guest

  2. #2

    Default Re: unicode in Image::Magick (hex values and braces problem?)

    On Tue, Jun 24, Anno Siegel inscribed on the eternal scroll:
    > > > > my $text="";
    > > > > for(my $uni=25000;$uni<25100;$uni++) {
    > > > > $text .= chr(hex($uni));
    > > > > $uni ++;
    > > > > }
    > To mimic the OP's code perfectly it should only use every other character.
    > Note that $uni is incremented once in the loop control and once in the
    > loop body.
    Gosh, so it does. I'm beginning to feel quite sorry for the original
    poster ;-) There's hardly a piece of the original coding that hasn't
    got torn to shreds by one or other of us.

    But this is an effective way to learn, even if it can prove
    embarrassing for the victim!

    Speaking for myself (by training a physicist, and therefore reputed to
    "code FORTRAN in any language"), I have to admit to frequently
    overlooking the "map" construct in favour of coding a loop.

    But at least I've learned to write that kind of loop in a more
    Perl-ish way (i.e per Tad's posting on this thread) than to mimic the
    C paradigm. Ho hum.
    Alan J. Flavell Guest

Similar Threads

  1. Image::Magick::Thumbnail::create problem
    By wapboy in forum PERL Modules
    Replies: 4
    Last Post: September 27th, 07:56 PM
  2. Image::Magick and padding of image
    By Lars Haugseth in forum PERL Modules
    Replies: 0
    Last Post: February 5th, 07:17 PM
  3. Image Magick
    By Kae Verens in forum PHP Development
    Replies: 4
    Last Post: January 9th, 07:06 PM
  4. Image::Magick Read Problem
    By Tim Hill in forum PERL Modules
    Replies: 6
    Last Post: September 18th, 07:41 AM
  5. [PHP] Image Magick
    By David T-G in forum PHP Development
    Replies: 0
    Last Post: August 26th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139