The double quotes never reached perl. In both cases, you are protecting your
oneliner from your shell with single quotes, so when you reached 'jan', the
"first" delimiter around that actually stopped shellquoting.

To get around this kind of thing use Perl's flexible quote operators. Eg.,

perl -MData::Dumper -e '@months = qw(jan feb mar apr ....);    ...and so on'

On Tue, Jul 26, 2011 at 8:47 PM, Avishalom Shalit <[email protected]>wrote:

> the difference is the double quotes in october.
>
>
> -----
>
>
> $ perl -MData::Dumper -e
>
> '@months=('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec');@t{@months
> }=1..12;print
> Dumper(\%t)'
> $VAR1 = {
>          'feb' => 2,
>          'may' => 5,
>          'mar' => 3,
>          'dec' => 12,
>          'jan' => 1,
>          'aug' => 8,
>          'sep' => 9,
>          '0' => 10,
>          'jun' => 6,
>          'nov' => 11,
>          'apr' => 4,
>          'jul' => 7
>        };
>
> $ perl -MData::Dumper -e
>
> '@months=('jan','feb','mar','apr','may','jun','jul','aug','sep',"oct",'nov','dec');@t{@months
> }=1..12;print
> Dumper(\%t)'
> $VAR1 = {
>          'feb' => 2,
>          'may' => 5,
>          'mar' => 3,
>          'dec' => 12,
>          'jan' => 1,
>          'aug' => 8,
>          'sep' => 9,
>          'jun' => 6,
>          'nov' => 11,
>          'apr' => 4,
>          'oct' => 10,
>          'jul' => 7
>        };
>
>
> -- vish
> _______________________________________________
> Perl mailing list
> [email protected]
> http://mail.perl.org.il/mailman/listinfo/perl
>



-- 
Gaal Yahas <[email protected]>
http://gaal.livejournal.com/
_______________________________________________
Perl mailing list
[email protected]
http://mail.perl.org.il/mailman/listinfo/perl

Reply via email to