Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

How to make an ascii flower variable

by girl (Initiate)
on Oct 18, 2011 at 19:23 UTC ( [id://932220]=perlquestion: print w/replies, xml ) Need Help??

girl has asked for the wisdom of the Perl Monks concerning the following question:

Any idea on how i can make an ascii flower and assign a variable to it?

Replies are listed 'Best First'.
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 ...)

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
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)

      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.

        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! ;-)

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?
Re: How to make an ascii flower variable
by parv (Parson) on Oct 19, 2011 at 00:38 UTC
    $another_name = '@},~`>~~' ;  #  Is this it?

      Line noise by any other name…

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.

      I think you're on to something:

      $hash = { cannabis, flower };

        Only someone on something like that would forget my or another qualifier as appropriate ;-)

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.

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>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://932220]
Approved by GrandFather
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-03-29 05:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found