How can I generate an array in Perl with 100 random values, without using a loop?
I have to avoid all kind of loops, like \"for\", foreach\", while. This is my exerc
Since the task seems to be either to get you to use recursion or to learn how to write an easy loop in a not-so-easy form, humbly I submit the following FULLY EXECUTABLE Perl programs:
#!/usr/bin/perl
''=~('('.'?'
.'{'.( '`'|'%').("\["^
'-').('`'| '!').('`'|',').'"'
.'\\'.'$'. ("\`"| ',').('`'|')').('`'|
'-').'='.('^'^("\`"| '/')).('^'^('`'|'.')).
('^'^('`'|'.')).';'.( '!'^'+').('`'|'&').('`'
|'/').('['^')').'(' .'\\'.'$'.'='.'='.(('^')^(
'`'|'/')).';'. '\\'.'$'.'='.'<'.'='.'\\'.'$'
.('`'|(',')).( '`'|')').('`'|'-').';'.'+'."\+".
'\\'.'$'.('='). ')'.'\\'.'{'.('['^'+').('['^"\.").(
'['^'(').("\`"| '(').('{'^'[').'\\'.'@'.'='.','.("\{"^
'[').('['^')'). ('`'|'!').('`'|'.').('`'|'$').'\\'.'}'.(
'!'^'+').'\\'. '$'.'='.'='.('^'^('`'|'/')).';'.('!'^'+')
.('`'|('&')).( '`'|'/').('['^')').('{'^'[').'('.'\\'.'@'.
'='.')'.('{'^'[').'\\'.'{'.('!'^'+').('*'^'#').('['^'+').(
'['^')').('`'|')').('`'|'.').('['^'/').('{'^'[').'\\'.'"'.(
'['^')').('`'|'!').('`'|'.').('`'|'$').('{'^'[').'\\'.'$'.
'='.('{'^'[').('`'|'/').('`'|'&').('{'^'[').'\\'.'$'.("\`"|
',').('`'|')').('`'|'-').'='.'\\'.'$'.'_'.'\\'.'\\'.(('`')|
'.').'\\'.'"'.';'.('!'^'+').('*'^'#').'\\'.'$'.'='.'+'.'+'
.';'.('!'^'+').('*'^'#').'\\'.'}'.'"'.'}'.')');$:='.' ^((
'~'));$~='@'|'(';$^=')'^'[';$/='`'|'.';$,='('^"\}"; $\=
'`'|'!';$:=')'^'}';$~='*'|'`';$^='+'^'_'; $/="\&"| '@'
;$,='['&'~';$\=','^'|';$:='.'^"\~";$~= '@'|'(' ;$^
=')'^ '[';$/='`'|'.';$,='('^"\}";$\= '`'|'!' ;$:
=')'^'}';$~='*'|'`';$^=('+')^ '_';$/= '&'
|'@';$,= '['&'~';$\ ="\,"^ '|';$: =(
('.'))^ "\~";$~= ('@')| '(';$^ =(
(')'))^ "\[";$/= "\`"| "\."; (
($,))= '('^'}'; ($\) ='`'
|"\!"; $:=(')')^ '}'; ($~)
='*'| "\`";$^= '+'^ '_';
($/)= '&'|'@' ;$,= '['&
'~'; $\=',' ^'|' ;$:=
'.'^ '~' ;$~= '@'|
'('; $^= ')' ^((
'[' )); $/= '`'
|(( '.' )); $,=
'(' ^(( '}' ))
;( ($\))= ((
(( '`')) ))
|+ "\!";$:= ((
')' ))^+ "\}"; $~
=(( '*'))| '`'; $^=
'+'^ "\_";$/= '&' |'@'
;($,)= ('[')&
"\~";$\= ','^'|'
#!/usr/bin/perl
''=~('(?{'.
('`'|'%').(
'['^"\-").(
'`'|"\!").(
'`'|(',')).
'"\\$'.('`'
|',').(
'`'|')'
).('`'|
('-')).
('=').(
'^'^('`'|
('/'))).(
'^'^('`'|
('.'))).(
'^'^(('`')|
'.')).';'.(
'!'^'+').('`'
|'&').(('`')|
'/').('['^')').
'(\\$=='.('^'^(
'`'|'/')).';\\$='
.'<=\\$'.('`'|',').
('`'|')').('`'|"\-").
';++\\$=)\\{'.('['^'+')
.('['^'.').('['^'(').('`'
|'(').('{'^'[').'\\@'.('`'|
'!').('['^')').('['^"\)").(
'`'|'!').('['^'"').','.('{'
^'[').('['^')').('`'|'!').(
'`'|'.').('`'|"\$").'\\}'.(
'!'^'+').'\\$'.('`'|')').'='.("\^"^( '`'|'/')).';'.('!'^('+')).(
'`'|'&').('`'|'/').('['^')').('{'^ '[').'(\\@'.('`'|'!').('['^
')').('['^')').('`'|'!').('['^ '"').')'.('{'^"\[").'\\{'.(
'!'^'+').('*'^'#').('['^'+') .('['^')').('`'|')').("\`"|
'.').('['^'/').('{'^'[') .'\\"'.('['^')').('`'|'!').
('`'|'.').('`'|"\$").( '{'^'[').'\\$'.('`'|"\)").(
'{'^'[').('`'|'/') .('`'|'&').('{'^'[').'\\$'.
('`'|',').("\`"| ')').('`'|'-').'=\\$_\\\\'.
('`'|('.')). '\\";'.('!'^'+').('*'^'#').
'\\$'.('`' |')').'++;'.('!'^'+').('*'^
"\#"). '\\}"})');$:='.'^'~';$~='@'
|'(' ;$^=')'^'[';$/='`'|"\.";$,=
'('^ '}';$\='`'|'!';$:=')'^"\}";
($~) ='*'|'`';$^='+'^'_';$/='&'|
'@'; $,='['&'~';$\=','^('|');$:=
'.'^ '~';$~='@'|'(';$^=')'^"\[";
($/) ='`'|'.';$,='('^'}';$\='`'|
'!'; $:=')'^'}';$~='*'|('`');$^=
'+'^ '_';$/='&'|'@';$,='['&"\~";
($\) =','^'|';$:='.'^'~';$~='@'|
'('; $^=')'^'[';$/='`'|('.');$,=
'('^ '}';$\='`'|'!';$:=')'^"\}";
($~) ='*'|'`';$^='+'^'_';$/='&'|
'@';$,='['&'~';$\=','^'|';$:='.'^'~' ;$~='@'|'(';$^=')'^"\[";$/=
'`'|'.';$,='('^'}';$\='`'|'!';$:=')' ^'}';$~='*'|'`';$^='+'^'_';
#!/usr/bin/perl
'?' =~(
'('.'?' ."\{".(
'`' |'%' ).('['^"\-").( '`'| '!'
).('`'|','). '"'. '\\'.('$').(
'`'|(',')).( '`'| ')').(('`')|
(( '-') )). +( '`' |')' ).
((( '[' ))^+ (( '/') )). '='
.('^'^ ('`'|'/')) .( '^'^("\`"| '.')).
+( '^'^('`'|'.')).';'.('!'^"\+"). ((
'\\')).'$'.('`'|'#').('`'|'/').('['^'.').('`'|'.').(
'['^ '/').'='. (('^')^( '`'|'/') ).(';').( '!'^
'+' ).('['^ '(').( ('[')^ "\.").( '`'
|'"' ).(('{')^ ('[')).( '['^'+') .('['^'.' ).+(
'['^'(').('`'|'(').'_'.('['^')').('`'|'!').('`'|'.')
.( '`'|'$').('{'^'[').'\\'."\{".( ((
'!'))^ '+').('{'^ (( ('[')))).( ('{')^
'[' ).( '{'^ (( '[') )). (((
(( '{') ))) ^+ '[' ).+( ((
'['))^')').( '`'| '%').(('[')^
'/').(('[')^ '.') .('['^')').(
'`' |'.' ).('{'^"\[").( '`'| ')'
).('`'| "\&").(
'{' ^((
'[' )))
.'\\'.+ '$'.'#'
.+( '`'| '!').('['^')') .''. (((
'['))^')').( '`'| '!').(('[')^
'"').('_').( '`'| '/').(('`')|
(( '&') )). (( '_' )).( ((
'[' ))^ ')') .( '`'| '!' ).(
('`')| '.').('`'| (( ('$')))).( ('[')^
(( '('))).'>'.'\\'.'$'.('`'|','). +(
'`'|')').('`'|'-').('`'|')').('['^'/').';'.('!'^'+')
.''. ('{'^'[') .(('{')^ ('[')).( '{'^'['). ('{'
^(( '['))). ("\["^ '+').( '['^'.' ).(
'['^ '(').('`' |"\(").( '{'^'[') .'\\'.'@' .''.
('`'|'!').('['^')').('['^')').('`'|'!').('['^('"')).
(( '_')).('`'|'/').('`'|'&').'_'. +(
('[')^ ')').('`'| (( ('!')))).( ('`')|
'.' ).( '`'| (( '$') )). (((
(( '[') ))) ^+ '(' ).(( ((
',')))).('{' ^'[' ).('['^')').
('`'|"\!").( '`'| '.').(('`')|
'$' ).(( ';')).('!'^'+' ).+( '{'
^'[').( '{'^'['
).( '{'
^(( '['
))).''. (('{')^
'[' ).+( '['^'+').('['^ '.') .+(
'['^('(')).( '`'| '(').('_').(
'['^(')')).( '`'| '!').(('`')|
(( '.') )). +( '`' |'$' ).
'(' .(( ')') ). ';'. ((( '!'
))^'+' ).'\\'.'}' .( '!'^'+').( ('!')^
(( '+'))).('!'^'+').('['^('(')).( ((
'['))^'.').('`'|'"').('{'^'[').('['^'+').('['^')').(
'`'| ')').('`' |"\.").( '['^'/') .'_'.('[' ^')'
).( '`'|'%' ).('`' |'#'). (('[')^ '.'
).+( '['^')'). ('['^'(' ).("\`"| ')').('[' ^'-'
).('`'|'%').('{'^'[').'\\'.'{'.('!'^'+').('{'^'[').(
(( '{'))^'[').('{'^'[').('{'^'[') .+
'\\'.+ '$'.("\["^ (( '/'))).'=' .('['^
'+' ).( '`'| (( '/') )). (((
(( '[') ))) ^+ '+' ).+( ((
'{'))^"\["). '\\' .'@'.'_'.';'
.('!'^'+').( '*'^ '#').(('[')^
'+' ).+( '['^')').('`'| ')') .+(
'`'|'.' ).('['^
'/' ).(
'{' ^((
'['))). ('\\').
'"' .''. ('['^')').('`' |'!' ).(
'`'|('.')).( '`'| '$').(('{')^
'[').('\\'). '$'. ('`'|"\#").(
(( '`') )|+ (( '/' ))). +(
'[' ^(( '.') )) .''. ((( '`'
))|'.' ).('['^'/' ). ('{'^'['). ("\`"|
(( '/'))).('`'|'&').('{'^'[').''. ((
'\\')).'$'.('`'|',').('`'|')').('`'|'-').('`'|')').(
'['^ '/').'='. '\\'.'$' .(('[')^ '/').'\\' .''.
((( '\\'))) .('`'| "\."). ('\\'). '"'
.';' .('!'^'+' ).("\*"^ '#').''. '\\'.'$'. ('`'
|'#').('`'|'/').('['^'.').('`'|'.').('['^'/').('+').
(( '+')).';'.('!'^'+').('*'^'#'). +(
('[')^ '+').('['^ (( (')')))).( ('`')|
')' ).( '`'| (( '.') )). (((
(( '[') ))) ^+ '/' ).(( ((
'_')))).('[' ^')' ).('`'|'%').
('`'|"\#").( '['^ '.').(('[')^
')' ).+( '['^'(').('`'| ')') .+(
'['^'-' ).('`'|
'%' ).+
'(' .((
'\\')). '@'.'_'
.(( ')') ).('{'^"\[").( '`'| ')'
).('`'|'&'). ('{' ^'[').('(').
'\\'.'@'.'_' .')' .';'.(('!')^
(( '+') )). (( ((( '\\' ))
))) .(( '}') ). ('!' ^(( '+'
))).+( '!'^'+').( (( '['))^'+') .('['^
(( '.'))).('['^'(').('`'|'(').'_' .(
'['^')').('`'|'!').('`'|'.').('`'|'$').'('.')'.';'.(
'['^ '+').('[' ^"\)").( '`'|')') .('`'|'.' ).+(
'[' ^"\/"). "\_".( ('[')^ "\)").( '`'
|'%' ).(('`')| ('#')).( '['^'.') .('['^')' ).+(
'['^'(').('`'|')').('['^'-').('`'|'%').'('.'\\'.'@'.
+( '`'|'!').('['^')').('['^')').( ((
'`'))| '!').('['^ (( '"'))).'_' .('`'|
'/' ).( '`'| (( '&') )). '_'
.( '['^ ')' ). ((( '`') )|
'!').(('`')| '.') .('`'|'$').(
'['^'(').')' .';' .'"'.'}'.')'
);( $:)= '.'^'~';$~='@' |'(' ;$^
=(')')^ '[';#;#
;#; #;#
In each case, the output is something like this:
rand 1 of 100=0.625268682212667
rand 2 of 100=0.30160434879096
...
rand 100 of 100=0.584811321826528
If you want to see the loops or recursion embedded within, you can use perl -MO=Deparse martini.pl or perl -MO=Deparse camel.pl etc.
Only with Perl, right???
If you want to generate these lovely things -- check out Acme::Eyedrops