String variable eval in binaries

Serge Aleynikov <>
Tue Jul 26 16:59:13 CEST 2005


I don't think it's a valid syntax.  Use:

<<$h, $e, $l, $l, $o>>.

and

list_to_binary(Str).

Serge

Inswitch Solutions wrote:
>  
> Hi,
>  
> <<"hello">>.
> <<104,101,108,108,111>>
> <<[$h, $e, $l, $l, $o]>>.
> ** exited: {badarg,[{erl_eval,expr,3}]} **
> Str = "hello".
> <<Str>>.
> ** exited: {badarg,[{erl_eval,expr,3}]} **
> Int =1.
> <<Int>>.
> <<1>>  
>  
> "hello" == [$h, $e, $l, $l, $o].
> true
>  
>  
> Any ideas? 
>  
>  
> thanks,
> Eduardo
>  
> 	
> 
> *Prepaid Expertise - Programmable Switches
> Powered by Ericsson Licensed Technology
> Eng. Eduardo Figoli - Development Center - IN Switch Solutions Inc.
> Headquarters - Miami-U.S.A. Tel: 1305-3578076 Fax: 1305-7686260
> Development Center - Montevideo - Uruguay Tel/Fax: 5982-7104457
> e-mail:  <mailto:>



More information about the erlang-questions mailing list