string literal in binary construction

Romain Lenglet <>
Thu Jul 13 02:38:21 CEST 2006


Vance Shipley wrote:
> 1> <<"123">>.

This is syntactic sugar for <<$1, $2, $3>>.

> <<"123">>
> 2> String = "123".
> "123"
> 3> <<String>>.
> ** exited: {badarg,[{erl_eval,expr,3}]} **

Use list_to_binary(String) instead.

-- 
Romain LENGLET



More information about the erlang-questions mailing list