Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Loading multiple identical variables in array with multiplication variable

by toolic (Bishop)
on Sep 24, 2014 at 16:49 UTC ( #1101832=note: print w/replies, xml ) Need Help??


in reply to Loading multiple identical variables in array with multiplication variable

More parens (Multiplicative Operators):
use warnings; use strict; my @arr = (("A") x 20, ("T") x 20, ("C") x 30, ("G") x 30); print scalar @arr, "\n"; __END__ 100
  • Comment on Re: Loading multiple identical variables in array with multiplication variable
  • Download Code

Replies are listed 'Best First'.
Re^2: Loading multiple identical variables in array with multiplication variable
by Jeri (Scribe) on Sep 24, 2014 at 16:54 UTC
    awesome. I wasn't able to properly search for it in the documentation. Thanks
      > I wasn't able to properly search for it in the documentation.

      see Re: Perldoc Keyword Search (update4)

      > pd x Matches for x found in : /usr/share/perl/5.10/pod/perlop.pod

      pager are opened for each match and files are scolled to the right place with highlighted keyword

      ">>> X<x> <<<" in perlop Binary "x" is the repetition operator. In scalar context or if + the left operand is not enclosed in parentheses, it returns a strin +g consisting of the left operand repeated the number of times spe +cified by the right operand. In list context, if the left operand is +enclosed in parentheses or is a list formed by "qw/STRING/", it repeats +the list. If the right operand is zero or negative, it returns an +empty string or an empty list, depending on the context. print '-' x 80; # print row of dashes print "\t" x ($tab/8), ' ' x ($tab%8); # tab over @ones = (1) x 80; # a list of 80 1's @ones = (5) x @ones; # set all elements to 5

      HTH! =)

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

      > I wasn't able to properly search for it in the documentation.

      Another approach: type "x" in the search-field here: http://perldoc.perl.org and you'll get

      • x
      • xor
      These operators are documented in perlop

      Cheers Rolf

      (addicted to the Perl Programming Language and ☆☆☆☆ :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1101832]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2019-06-17 23:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (80 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!