The "qw" means quote word(s). This is aide to help in typing in lots of strings. That's all it does.

If you want to mix decimal,octal,hex numbers in some @a=qw(...),see below. Just ask Perl to evaluate what that string means in terms of an actual "number".

#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @array_of_strings = qw (10 20 0x47 1 30 0b011); # # "qw" is "quote word(s), this is the same as: # my @array_of_strings = ("10","20","0x47","1","30","0b011"); print Dumper \@array_of_strings; # only string context not "numbers" my @array = map{eval $_}@array_of_strings; # or my @array = map{eval $_} qw (10 20 0x47 1 30 0b011); print Dumper \@array; __END__ prints: $VAR1 = [ '10', '20', '0x47', '1', '30', '0b011' ]; $VAR1 = [ 10, 20, 71, 1, 30, 3 ];
Update: added a binary number to example.

In reply to Re: Converting quoted strings to numbers in array by Marshall
in thread Converting quoted strings to numbers in array by pritesh_ugrankar

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.