Re: How to make an ascii flower variable
by Perlbotics (Archbishop) on Oct 18, 2011 at 19:47 UTC
|
Easy ;-) Just
- open Gimp,
- draw flower,
- save as ASCII-art (as flower.txt),
- open editor, insert flower.txt and
- read into variable using here doc (or read via DATA),
- run,
- enjoy!
use strict;
use warnings;
my $flower = <<'EARTH';
_ajQQQ6
jQQQQQQQ6/
_aaaaa ]QQQQQQQQQQ6/
_QQQQWQQ6 ]QQQQQQQQQQQQ
jQQQQQQQQfQQQQ? 4QQQQQf
jQQQQQQQQQfQQQQ/ )4QQQf
QQQQP?QQQQfWQQQQQQaayQQQf
QQQQ ]QQQQf"QQQQQQQWQQQQQQ6/
QQQQ_QQQQQajQQQQQQQQQQQQQQQQQQ/
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQf
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
4QQQQQQQQQQQQQQQQQQQQQQf )WQQQ
aaajQQQQQQQQQQQQQQQQQQQQQQf _QQQQ
]QQQQQQQQQQQQQQQQQQQQQQQQQQQaaQQQQQ
QQQQQQQQQQQQQQ?????QQQQQQQQQQWQQQQ'
jQQQQQQQQQQQQQP )WQQQQQQQQQQQQf
QQQQQQQQQQQQQQQaaaaaajQQQQQQQQQQQQQ/
QQQQajQQQQQQQQQQWQWWWQQQQQQQQQQQQQQQ/
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
4QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ
4QQQQQQQQQQQQQQQQQQQQQQQQQQ QQQQ
)4QQQf4QQQQQQQQQQQQQQQQQQa/ QQQQ
]QQQ6 QQQQQQQQQQQQQQQQQQQQQQQQQQf
]QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQf
)WQQQQQQQQQQQQQQQaaaaWQQQQQQQQQQ'
QQQQQQQQQQQQQQQWWWWQQQQQQQQQP'
)4QQP?4QQP4QQQQQQQQQQQP
]QQf ?QQQQQQQQQ'
_QQQf QQQ )??????
]QQQQ/ QQQ
]QQQQQ ]QQf jQQ/
]QQQQQ/ QQQf jQQQf
]QQQQQQ/ _QQQ _QQQQf
]QQPQQQ6 ]QQP _QQQQQf
]QQf]QQQQ/ ]QQf _QQQQQQf
]QQf 4QQQ6 ]QQf _jQQQQQQQf
)WQ6 ?QQQf ]QQf _QQQQQ']QQf
QQQf 4QQQ/ ]QQf _QQQQP' QQQf
4QQQ QQQQ ]QQfjQQQQf ]QQQ'
)QQQ/ )WQQ6]QQQQQQQ' _jQQf
4QQQa ]QQQjQQQQQP' jQQQ'
)QQQQ6/ 4QQQQQQQQ jQQQP
)WQQQQ/)QQQQQ??? _QQQQP
4QQQQWPQQQQ _jQQQQP
]QQQQQQQQQaaaQQQQQ?
)?QQQQ4QQQQWQQQQ?
?QQQQQQQQQQQf
QQQ)???'
QQQ
QQQ
QQQ
QQQ
QQQ
QQQ
QQQ6
4QQQ
QQQ
]QQ
]QQ
EARTH
print $flower;
Update:Or read it from the file, e.g. using File::Slurp:
my $flower = read_file("flower.txt");.
.oO( ... rather SOIL than EARTH ...)
| [reply] [Watch: Dir/Any] [d/l] [select] |
Re: How to make an ascii flower variable
by toolic (Bishop) on Oct 18, 2011 at 19:29 UTC
|
Here's my interpretation of your question:
use warnings;
use strict;
my $var = '
###### # #### # # ###### #####
# # # # # # # # #
##### # # # # # ##### # #
# # # # # ## # # #####
# # # # ## ## # # #
# ###### #### # # ###### # #
';
print $var;
Text::Banner | [reply] [Watch: Dir/Any] [d/l] |
Re: How to make an ascii flower variable
by anneli (Pilgrim) on Oct 19, 2011 at 01:31 UTC
|
use utf8;
$✿ = "works for me?";
(yes it's not ASCII but I mean really) | [reply] [Watch: Dir/Any] |
|
I cut and pasted that code into emacs. Initially things looked good (the flower appeared to be a flower variable etc.). It didn't work when I ran it. How exactly is this working for you?
Code:
use utf8;
$✿ = "works for me?";
Output:
perl fleur.pl
Malformed UTF-8 character (unexpected end of string) at fleur.pl line
+3.
Unrecognized character \x9C; marked by <-- HERE after $\342<-- HERE ne
+ar column\
2 at fleur.pl line 3.
| [reply] [Watch: Dir/Any] [d/l] |
|
Hmm, how odd! It ran without complaint or error at work; when I try it at home now, I get the same error as you (which is documented as being correct behaviour!). I'll have to try again at work tomorrow! ;-)
| [reply] [Watch: Dir/Any] |
|
|
|
|
Re: How to make an ascii flower variable
by ikegami (Patriarch) on Oct 18, 2011 at 19:49 UTC
|
ASCII has no flower, and assigning a variable to a flower or character makes no sense. Could you please try explaining what you want again? | [reply] [Watch: Dir/Any] |
Re: How to make an ascii flower variable
by parv (Parson) on Oct 19, 2011 at 00:38 UTC
|
$another_name = '@},~`>~~' ; # Is this it? | [reply] [Watch: Dir/Any] [d/l] |
|
| [reply] [Watch: Dir/Any] |
Re: How to make an ascii flower variable
by Jenda (Abbot) on Oct 19, 2011 at 21:03 UTC
|
A Google search found this page which calls the curlies {} "flower brackets" and talks about "flower variables" meaning variables written as ${name} instead of $name because of interpolation in a string like "mv $file ${file}_old".
Maybe that's what girl meant. Maybe.
Jenda
Enoch was right!
Enjoy the last years of Rome.
| [reply] [Watch: Dir/Any] [d/l] [select] |
|
$hash = { cannabis, flower };
| [reply] [Watch: Dir/Any] [d/l] |
|
| [reply] [Watch: Dir/Any] [d/l] |
|
Re: How to make an ascii flower variable
by hbm (Hermit) on Oct 19, 2011 at 19:13 UTC
|
You make an ascii flower from an ascii seed: Fill a CAN (24) with organic BS (8); drop in a P; add a little H-2-O; and place it in a sunny Window.
For variable, try a different-facing Window or out on the DEC.
| [reply] [Watch: Dir/Any] |
Re: How to make an ascii flower variable
by rovf (Priest) on Oct 19, 2011 at 08:26 UTC
|
and assign a variable to it
If you assign a variable *to* a flower, this would destroy the flower.
On second thought: If I remember right, flowers are readonly in Perl....
--
Ronald Fischer <ynnor@mm.st>
| [reply] [Watch: Dir/Any] [d/l] |