convert integer to string

Discussion in 'Perl Misc' started by ccc31807, Jun 8, 2010.

  1. ccc31807

    ccc31807 Guest

    This is embarrassing!

    I read an input file, split each row on the separators, pick out the
    unique key (which consists of seven digits), create a hash element on
    the key, and read the other values into an anonymous hash. This has
    worked for years without a hitch.

    Yesterday, my user requested the app to print a calculated field,
    which is a list of names contained in a secondary file. I thought, "No
    problem, I'll just create a new element in my anonymous hash,
    concatenate each name unless the name already matched the string, and
    print it out." Didn't work, but the errors seemed to be random and
    arbitrary.

    After a couple of hours, I used bdf's trick to print out the hash, and
    discovered much to my embarrassment that the keys weren't the same. In
    the main loop where I created the hash, the keys were as expected and
    consisted of seven characters which are all digits. HOWEVER, in the
    loop where I created the additional hash element, the keys with
    leading zeros did not match. Here is an example of the hash:

    0123456 => HASH(deadbeed)
    id => 0123456
    name => joe
    gender => male
    new_field =>
    123456 => HASH(deadbeef)
    new_field => list of concatenated strings

    I read the main file and create the main hash on the unique key, one
    element of which is 'new_field' with an initial value of ' '. Then, I
    read a secondary file which contains the key and ATTEMPT to
    concatenate an element to the main hash element new_field. Instead, it
    creates a new hash element with the numeric value of the unique key
    instead of the string value.

    So, I guess my question is how I convert an integer to a string to
    preserve the leading zeros.

    According to MJD on his infrequently asked questions page, the answer
    is, "Try using a whip." But that doesn't tell me what kind of whip.
    http://perl.plover.com/IAQ/IAQlist.html#how_can_i_force_perl_to_treat_a_number_as_a_string

    CC.
     
    ccc31807, Jun 8, 2010
    #1
    1. Advertising

  2. ccc31807

    Ralph Malph Guest

    > So, I guess my question is how I convert an integer to a string to
    > preserve the leading zeros.
    >
    > According to MJD on his infrequently asked questions page, the answer
    > is, "Try using a whip." But that doesn't tell me what kind of whip.
    > http://perl.plover.com/IAQ/IAQlist.html#how_can_i_force_perl_to_treat_a_number_as_a_string

    The whip I usually use is string concatenation or variable interpolation
    within double quotes.
    Something like

    my $number=5;
    my $string="000".$number;

    Surely there are several ways to do this.
    This always works for me! :)
     
    Ralph Malph, Jun 8, 2010
    #2
    1. Advertising

  3. ccc31807

    Uri Guttman Guest

    >>>>> "c" == ccc31807 <> writes:

    c> After a couple of hours, I used bdf's trick to print out the hash, and
    c> discovered much to my embarrassment that the keys weren't the same. In
    c> the main loop where I created the hash, the keys were as expected and
    c> consisted of seven characters which are all digits. HOWEVER, in the
    c> loop where I created the additional hash element, the keys with
    c> leading zeros did not match. Here is an example of the hash:

    what trick? use Data::Dumper and no trick is needed.

    c> 0123456 => HASH(deadbeed)
    c> id => 0123456

    that is an OCTAL literal. when parsed into perl it will be converted to
    an integer and later printed in decimal. if those are always keys which
    means strings, never print or use them without quotes. don't think of
    them as numbers but strings with all digits.

    c> So, I guess my question is how I convert an integer to a string to
    c> preserve the leading zeros.

    if you already have corrupted numbers, use sprintf to pad them with
    zeros. but i suspect you will still have nasty errors as you will have
    converted from the literal octal value now to a decimal. you can sprintf
    the number back in octal to compensate. the proper solution is to never
    let perl see those as literal octal numbers but always as strings. i
    dunno what your code is doing (as you didn't post any) to make this
    happen. are you doing an eval on some incoming data? that is a no-no! do
    a proper parse and you can keep those keys as strings.

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Jun 8, 2010
    #3
  4. ccc31807

    ccc31807 Guest

    On Jun 8, 2:26 pm, "Uri Guttman" <> wrote:
    > dunno what your code is doing (as you didn't post any) to make this
    > happen. are you doing an eval on some incoming data? that is a no-no! do
    > a proper parse and you can keep those keys as strings.


    This is what I'm doing.

    The main file looks like this:
    0123456|joe|male|etc ...

    which I manipulate as follows:
    my ($id, $name, $gender, @rest) = split /\|/;
    $main_hash{$id} = {
    id => $id,
    name => $name.
    gender => $gender,
    rest => @rest,
    new_value => ' ',
    };

    The secondary file looks like this:
    0123456|this|etc ...
    0123456|is|etc ...
    0123456|a|etc ...
    0123456|list|etc ...
    0123456|of|etc ...
    0123456|strings|etc ...

    which I manipulate as follows:
    my ($id, $string, @rest) = split /\|/;
    $main_hash{$id}{new_value} .= $string unless $main_hash{$id}
    {new_value} =~ /$string/; #the strings can be duplicated but I only
    want one of each

    So, should I double quote the $id when I use it as a hash key? That
    strikes me as idiosyncratic even for Perl.

    CC.
     
    ccc31807, Jun 8, 2010
    #4
  5. ccc31807

    J. Gleixner Guest

    ccc31807 wrote:
    > On Jun 8, 2:26 pm, "Uri Guttman" <> wrote:
    >> dunno what your code is doing (as you didn't post any) to make this
    >> happen. are you doing an eval on some incoming data? that is a no-no! do
    >> a proper parse and you can keep those keys as strings.

    >
    > This is what I'm doing.
    >
    > The main file looks like this:
    > 0123456|joe|male|etc ...
    >
    > which I manipulate as follows:
    > my ($id, $name, $gender, @rest) = split /\|/;
    > $main_hash{$id} = {
    > id => $id,
    > name => $name.
    > gender => $gender,
    > rest => @rest,
    > new_value => ' ',
    > };
    >
    > The secondary file looks like this:
    > 0123456|this|etc ...
    > 0123456|is|etc ...
    > 0123456|a|etc ...
    > 0123456|list|etc ...
    > 0123456|of|etc ...
    > 0123456|strings|etc ...
    >
    > which I manipulate as follows:
    > my ($id, $string, @rest) = split /\|/;
    > $main_hash{$id}{new_value} .= $string unless $main_hash{$id}
    > {new_value} =~ /$string/; #the strings can be duplicated but I only
    > want one of each
    >
    > So, should I double quote the $id when I use it as a hash key? That
    > strikes me as idiosyncratic even for Perl.
    >
    > CC.


    Provide actual code that we can run that shows your issue and so we can
    see what's happening.
     
    J. Gleixner, Jun 8, 2010
    #5
  6. ccc31807

    J. Gleixner Guest

    ccc31807 wrote:
    > This is embarrassing!
    >
    > I read an input file, split each row on the separators, pick out the
    > unique key (which consists of seven digits), create a hash element on
    > the key, and read the other values into an anonymous hash. This has
    > worked for years without a hitch.
    >
    > Yesterday, my user requested the app to print a calculated field,
    > which is a list of names contained in a secondary file. I thought, "No
    > problem, I'll just create a new element in my anonymous hash,
    > concatenate each name unless the name already matched the string, and
    > print it out." Didn't work, but the errors seemed to be random and
    > arbitrary.
    >
    > After a couple of hours, I used bdf's trick to print out the hash, and
    > discovered much to my embarrassment that the keys weren't the same. In
    > the main loop where I created the hash, the keys were as expected and
    > consisted of seven characters which are all digits. HOWEVER, in the
    > loop where I created the additional hash element, the keys with
    > leading zeros did not match. Here is an example of the hash:


    Most folks really don't need to know the backstory. Post your code,
    your results, your expectations, and your questions.
     
    J. Gleixner, Jun 8, 2010
    #6
  7. ccc31807

    ccc31807 Guest

    On Jun 8, 3:18 pm, "J. Gleixner" <>
    wrote:
    > Provide actual code that we can run that shows your issue and so we can
    > see what's happening.


    Here is the working code in my test script. Unfortunately, I can't
    post the data files. Note that this code does some other things and
    contains debugging statements.

    open FAC, '<', "FAC_${term}.csv", or die "Cannot open FAC, $!";
    chomp ($header = <FAC>);
    while (<FAC>)
    {
    next unless /\w/;
    chomp;
    my ($changed, $last, $first, $middle, $id2, $region, $contract,
    $addy1, $addy2, $csz, $mail, $trs, @courses) = parse_line(',', $bool,
    $_);
    print "id2 is [$id2] and facid is [$facid]\n";
    if ($facid !~ /\?/) { next unless $id2 eq $facid; }
    $fac{$id2} = {
    id2 => $id2,
    contract => $contract,
    first => $first,
    middle => $middle,
    last => $last,
    addy1 => $addy1,
    addy2 => $addy2,
    csz => $csz,
    mail => $mail,
    trs => $trs,
    courses => @courses,
    xlist => '',
    }
    }
    close FAC;

    open SEC, '<', "$sections_file", or die "Cannot open SEC, $!";
    chomp ($header = <SEC>);
    while (<SEC>)
    {
    next unless /\w/;
    chomp;
    s/'/\\'/g;
    my ($last, $first, $middle, $id1, $filename, $crs_id, $site, $loc,
    $glcode, $level, $count, $status, $section, $title, $hours, $xlist,
    $total, $travel, $contract) = parse_line(',', 0, $_);
    next if $contract =~ /N/;
    $sec{$crs_id} = {
    crs_id => $crs_id,
    filename => $filename,
    id1 => $id1,
    site => $site,
    loc => $loc,
    glcode => $glcode,
    level => $level,
    count => $count,
    status => $status,
    section => $section,
    title => $title,
    hours => $hours,
    xlist => $xlist,
    total => $total,
    travel => $travel,
    contract => $contract,
    };
    $xlist{$id1} .= "$section " if $xlist =~ /\d/ and $xlist !~ /
    $section/;
    $fac{$id1}{xlist} .= "$section " if $xlist =~ /\d/;
    }
    close SEC;
     
    ccc31807, Jun 8, 2010
    #7
  8. ccc31807

    Uri Guttman Guest

    >>>>> "c" == ccc31807 <> writes:

    c> On Jun 8, 2:26 pm, "Uri Guttman" <> wrote:
    >> dunno what your code is doing (as you didn't post any) to make this
    >> happen. are you doing an eval on some incoming data? that is a no-no! do
    >> a proper parse and you can keep those keys as strings.


    c> This is what I'm doing.

    c> The main file looks like this:
    c> 0123456|joe|male|etc ...

    c> which I manipulate as follows:
    c> my ($id, $name, $gender, @rest) = split /\|/;
    c> $main_hash{$id} = {
    c> id => $id,
    c> name => $name.
    c> gender => $gender,
    c> rest => @rest,

    that is wrong as it will put the whole array there. you need a ref to
    that array or an anon ref.

    c> new_value => ' ',
    c> };

    c> The secondary file looks like this:
    c> 0123456|this|etc ...
    c> 0123456|is|etc ...
    c> 0123456|a|etc ...
    c> 0123456|list|etc ...
    c> 0123456|of|etc ...
    c> 0123456|strings|etc ...

    c> which I manipulate as follows:
    c> my ($id, $string, @rest) = split /\|/;
    c> $main_hash{$id}{new_value} .= $string unless $main_hash{$id}
    c> {new_value} =~ /$string/; #the strings can be duplicated but I only
    c> want one of each

    c> So, should I double quote the $id when I use it as a hash key? That
    c> strikes me as idiosyncratic even for Perl.

    in that limited code i don't see where the keys would be interpreted as
    literal numbers. there must be something else going on which is doing
    that. perl won't lose leading zeroes in strings without doing some
    number conversions. are you sure you never look at those kays as
    numbers? like use == to check them or similar? since they seem to be
    fixed size you can always use the string comparison ops safely.

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Jun 8, 2010
    #8
  9. ccc31807

    Uri Guttman Guest

    >>>>> "c" == ccc31807 <> writes:

    c> On Jun 8, 3:18 pm, "J. Gleixner" <>
    c> wrote:
    >> Provide actual code that we can run that shows your issue and so we can
    >> see what's happening.


    c> Here is the working code in my test script. Unfortunately, I can't
    c> post the data files. Note that this code does some other things and
    c> contains debugging statements.

    c> open FAC, '<', "FAC_${term}.csv", or die "Cannot open FAC, $!";
    c> chomp ($header = <FAC>);
    c> while (<FAC>)
    c> {
    c> next unless /\w/;
    c> chomp;
    c> my ($changed, $last, $first, $middle, $id2, $region, $contract,
    c> $addy1, $addy2, $csz, $mail, $trs, @courses) = parse_line(',', $bool,
    c> $_);
    c> print "id2 is [$id2] and facid is [$facid]\n";
    c> if ($facid !~ /\?/) { next unless $id2 eq $facid; }
    c> $fac{$id2} = {
    c> id2 => $id2,
    c> contract => $contract,
    c> first => $first,
    c> middle => $middle,
    c> last => $last,
    c> addy1 => $addy1,
    c> addy2 => $addy2,
    c> csz => $csz,
    c> mail => $mail,
    c> trs => $trs,
    c> courses => @courses,

    same bug as i pointed out in another post. you need a ref or anon array
    there. that is very wrong. who knows what it is doing to your app?

    c> xlist => '',
    c> }

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Jun 8, 2010
    #9
  10. ccc31807

    ccc31807 Guest

    On Jun 8, 3:06 pm, Ben Morrow <> wrote:
    > '%main_hash' is an appallingly bad name for a variable. Why is it there?
    > What's it got in it? (In this case, probably, something like '%people'
    > might be better.)



    Sorry. I posted the code where I populated the two hashes, named %fac
    and %sec.

    > You want \Q\E here.


    Trying that now.

    > So you must be doing something else.


    Not intentionally.

    CC.
     
    ccc31807, Jun 8, 2010
    #10
  11. ccc31807

    ccc31807 Guest

    On Jun 8, 3:31 pm, "Uri Guttman" <> wrote:
    >   c>         courses => @courses,
    >
    > same bug as i pointed out in another post. you need a ref or anon array
    > there. that is very wrong. who knows what it is doing to your app?


    @courses contains a list of numeric keys. If I:
    print "Courses: [@courses]\n";
    it will output something like this:
    Courses: [23456 34567 45678]

    This is NOT the problem here. What this does is make the hash element
    $fac{$id}{courses} contain a scalar value like this:
    '23456 34567 45678' This works perfectly and does exactly what I want
    it to.

    But thanks for pointing this out, CC.
     
    ccc31807, Jun 8, 2010
    #11
  12. ccc31807

    Willem Guest

    ccc31807 wrote:
    ) On Jun 8, 3:31?pm, "Uri Guttman" <> wrote:
    )> ? c> ? ? ? ? courses => @courses,
    )>
    )> same bug as i pointed out in another post. you need a ref or anon array
    )> there. that is very wrong. who knows what it is doing to your app?
    )
    ) @courses contains a list of numeric keys. If I:
    ) print "Courses: [@courses]\n";
    ) it will output something like this:
    ) Courses: [23456 34567 45678]
    )
    ) This is NOT the problem here. What this does is make the hash element
    ) $fac{$id}{courses} contain a scalar value like this:
    ) '23456 34567 45678' This works perfectly and does exactly what I want
    ) it to.

    No, it doesn't.

    It would if you spelled it like this:

    courses => "@courses",

    But now, it would make:

    $fac{$id}{courses} contain '23456', and
    $fac{$id}{34567} contain '45678'.

    And count yourself lucky that there are an odd number of elements,
    otherwise the following keys and values would be swapped around.


    SaSW, Willem
    --
    Disclaimer: I am in no way responsible for any of the statements
    made in the above text. For all I know I might be
    drugged or something..
    No I'm not paranoid. You all think I'm paranoid, don't you !
    #EOT
     
    Willem, Jun 8, 2010
    #12
  13. ccc31807

    J. Gleixner Guest

    ccc31807 wrote:
    > On Jun 8, 3:18 pm, "J. Gleixner" <>
    > wrote:
    >> Provide actual code that we can run that shows your issue and so we can
    >> see what's happening.

    >
    > Here is the working code in my test script. Unfortunately, I can't
    > post the data files. Note that this code does some other things and
    > contains debugging statements.


    How can we run this?

    Create a short example we can run that shows the issue. Just
    populate an array or two with example data and use that
    in place of your files.

    Narrow your example code down to the issue, get rid of all the other
    stuff and you might find the problem on your own.
     
    J. Gleixner, Jun 8, 2010
    #13
  14. ccc31807

    ccc31807 Guest

    On Jun 8, 4:05 pm, Willem <> wrote:
    > ) This is NOT the problem here. What this does is make the hash element
    > ) $fac{$id}{courses} contain a scalar value like this:
    > ) '23456 34567 45678' This works perfectly and does exactly what I want
    > ) it to.
    >
    > No, it doesn't.


    I beg to differ, but it does. I've been running this particular piece
    of code for about three years, and it has exactly the behavior I
    described. This is a line from my debugging file with only the
    personal information replaced with XXXXX.

    1073251 => HASH(0x1e4ea6c)
    xlist =>
    middle => A
    first => XXXXX
    contract => XXXXX
    csz => XXXXX
    addy2 =>
    courses => 235519 235524 237125
    last => XXXXX
    id2 => 1073251
    addy1 => XXXXX Drive
    mail => XXXXX@XXXXX
    trs => Current Member
     
    ccc31807, Jun 8, 2010
    #14
  15. ccc31807

    ccc31807 Guest

    On Jun 8, 2:10 pm, ccc31807 <> wrote:
    > This is embarrassing!


    Okay, now I really am embarrassed. It's not a Perl problem at all --
    it's a Microsoft problem.

    The script that I reference is the third one out of four, the whole
    process takes about six input files and outputs several thousand PDF
    files. I get the data from various people and a couple of databases.

    I get some of the data in CSV format. One of my sources switched from
    an Access database to an Excel file. Turns out that Excel strips out
    the leading zeros if it thinks that the datum is an integer.

    I really, really should have learned this lesson by now -- check the
    code, check the data. Yes, I mostly validate the data as it comes in,
    checking the format and so on, and the particular numeric datum I used
    as a key validated as numeric. It never occurred to me to look at the
    data file until after I spent several hours checking and rechecking my
    code and posting on c.l.p.m.

    'Garbage in, garbage out' isn't always the result of bad code, it can
    be the result of bad data. Thanks to all, and please accept my apology
    for the excitement.

    CC.
     
    ccc31807, Jun 8, 2010
    #15
  16. ccc31807

    Uri Guttman Guest

    >>>>> "c" == ccc31807 <> writes:

    c> On Jun 8, 4:05 pm, Willem <> wrote:
    >> ) This is NOT the problem here. What this does is make the hash element
    >> ) $fac{$id}{courses} contain a scalar value like this:
    >> ) '23456 34567 45678' This works perfectly and does exactly what I want
    >> ) it to.
    >>
    >> No, it doesn't.


    c> I beg to differ, but it does. I've been running this particular piece
    c> of code for about three years, and it has exactly the behavior I
    c> described. This is a line from my debugging file with only the
    c> personal information replaced with XXXXX.

    then that is not the code that you are using. it will put the list of
    courses into the hash as key/value pairs. the only way you get what you
    claim is with "@courses". did you lose the quotes in pasting? if you
    claim that, show exact runnable code that does this. you can whip up an
    dummy example in 2 minutes. here is one:

    perl -MData::Dumper -e '@x = ( 1 .. 4 ) ; %y = (x => @x); print Dumper \%y'
    $VAR1 = {
    '4' => undef,
    'x' => 1,
    '2' => 3
    };

    as seen, it doesn't do what you claim it does. possibly the dump trick
    you are using is misleading you. use data::dumper to see what is really
    there. here is what you seem to want:

    perl -MData::Dumper -e '@x = ( 1 .. 4 ) ; %y = (x => "@x"); print Dumper \%y'
    $VAR1 = {
    'x' => '1 2 3 4'
    };


    or alternatively with a ref:

    perl -MData::Dumper -e '@x = ( 1 .. 4 ) ; %y = (x => \@x); print Dumper \%y'
    $VAR1 = {
    'x' => [
    1,
    2,
    3,
    4
    ]
    };


    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Jun 8, 2010
    #16
  17. ccc31807

    Uri Guttman Guest

    >>>>> "c" == ccc31807 <> writes:

    c> 'Garbage in, garbage out' isn't always the result of bad code, it
    c> can be the result of bad data. Thanks to all, and please accept my
    c> apology for the excitement.

    you still have a bug if you claim x => @y will do what you want. see my
    other post on this.

    uri

    --
    Uri Guttman ------ -------- http://www.sysarch.com --
    ----- Perl Code Review , Architecture, Development, Training, Support ------
    --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
     
    Uri Guttman, Jun 8, 2010
    #17
  18. ccc31807

    ccc31807 Guest

    On Jun 8, 4:40 pm, "Uri Guttman" <> wrote:
    > you still have a bug if you claim x => @y will do what you want. see my
    > other post on this.


    -----------SCRIPT---------------
    #! perl
    # array.plx
    use strict;
    use warnings;
    my %presidents;
    while (<DATA>)
    {
    chomp;
    my ($order, $first, $last, @years) = split /\|/;
    $presidents{$order} = {
    first => $first,
    last => $last,
    years => @years,
    };
    }

    foreach my $k (sort keys %presidents)
    {
    print "$k => $presidents{$k}\n";
    foreach my $k2 (sort keys %{$presidents{$k}})
    {
    print " $k2 => $presidents{$k}{$k2}\n";
    }
    }
    exit(0);

    __DATA__
    1|George|Washington|1788 1792
    2|John|Adams|1796
    3|Thomas|Jefferson|1800 1804
    4|James|Madison|1808 1812
    32|Franklin|Roosevelt|1932 1936 1940 1944

    ----------OUTPUT----------------
    D:\PerlLearn>perl array.plx
    01 => HASH(0x248e5c)
    first => George
    last => Washington
    years => 1788 1792
    02 => HASH(0x182a344)
    first => John
    last => Adams
    years => 1796
    03 => HASH(0x182a3b4)
    first => Thomas
    last => Jefferson
    years => 1800 1804
    04 => HASH(0x182a8a4)
    first => James
    last => Madison
    years => 1808 1812
    32 => HASH(0x183ce44)
    first => Franklin
    last => Roosevelt
    years => 1932 1936 1940 1944
     
    ccc31807, Jun 8, 2010
    #18
  19. On Tue, 08 Jun 2010 14:12:53 -0700, ccc31807 wrote:

    > On Jun 8, 4:40 pm, "Uri Guttman" <> wrote:
    >> you still have a bug if you claim x => @y will do what you want. see my
    >> other post on this.

    >
    > -----------SCRIPT---------------

    (snip)
    > my ($order, $first, $last, @years) = split /\|/; $presidents

    {$order} =
    > {
    > first => $first,
    > last => $last,
    > years => @years,
    > };

    (snip)
    >
    > __DATA__
    > 1|George|Washington|1788 1792

    (snip)

    This only "works" because @years has only one element, the string "1788
    1792". It is still wrong, wrong, wrong. Fix your code before someone tags
    on another element on the end and everything breaks.

    HTH,
    M4
     
    Martijn Lievaart, Jun 8, 2010
    #19
  20. ccc31807

    ccc31807 Guest

    On Jun 8, 5:47 pm, Tad McClellan <> wrote:
    > @years always contains exactly one element, it is a non-arrayish array.
    >
    > $years would work as well, and would avoid looking like it wouldn't
    > work...
    >


    You are right.

    As an explanation, not an excuse, the &rest parameter in Lisp takes
    the rest of the arguments and flattens all lists. I've found this very
    useful in manipulating Lisp data, and guess I was half asleep at the
    wheel, channeling Lisp while writing Perl.

    What I saw was 'courses' as an array, and in fact use @courses later
    on in the script to iterate through the elements, and was thinking
    'list' when I should have seen 'scalar.'

    My bad, and now I'm triple embarrassed. Uri and the others were
    correct, and I wasn't.

    CC.
     
    ccc31807, Jun 9, 2010
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon Paskett

    Convert a Base32 string to Base10 integer

    Jon Paskett, Dec 18, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    1,168
    Nathan Sokalski
    Dec 18, 2005
  2. Azmie
    Replies:
    12
    Views:
    1,068,827
    Azmie
    Dec 30, 2003
  3. les ander
    Replies:
    4
    Views:
    923
    wes weston
    Oct 5, 2004
  4. news
    Replies:
    2
    Views:
    1,135
  5. Randy Kramer
    Replies:
    12
    Views:
    403
    Robert Klemme
    Oct 25, 2007
Loading...

Share This Page