in reply to Why is const x const not a const?

Why is "a" x 3 not considered a constant string...?

As I see it, "a" is a const with x signifying a repeat of 3. With that in mind, I went for a walk:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper::Concise; use B::Concise qw/ walk_output set_style_standard /; my $walker = B::Concise::compile('-concise', 'newFunc'); walk_output( \*STDOUT ); print Dumper ( $walker->() ); set_style_standard( 'terse' ); print Dumper ( $walker->() ); sub newFunc { my $s = 'a x 3'; }
In other words, 'a' is the constant string, which seems like the right thing to me; however, 'a x 3' is a constant string. Use that instead.

Replies are listed 'Best First'.
Re^2: Why is const x const not a const?
by BrowserUk (Patriarch) on Jan 22, 2012 at 14:06 UTC
    'a x 3' is a constant string. Use that instead.

    You are aware that the result of the expression 'a' x 3 is 'aaa'?


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?