<div dir="ltr"><div>The program below will read and then write one line at a time; hopefully it will help you get started. Â Keep in mind that the task you describe isn't going to touch on concurrency or any of the other great parts of Erlang. Â Try writing a little proxy server, then you will have fun. :)</div><br><div><br></div><div><div><font face="courier new, monospace">#!/usr/bin/env escript</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">main(_Params) -></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">      </span>handle().</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">handle() -></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre"> </span>handle(io:get_line([])).</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">handle(eof) -></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">       </span>halt(0);</font></div><div><font face="courier new, monospace"><br></font></div><div><font face="courier new, monospace">handle(Data) -></font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">      </span>io:format("~s", [Data]),</font></div><div><font face="courier new, monospace"><span class="" style="white-space:pre">        </span>handle().</font></div></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 11, 2014 at 11:07 AM, Eliezer Croitoru <span dir="ltr"><<a href="mailto:eliezer@ngtech.co.il" target="_blank">eliezer@ngtech.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
My name is Eliezer and I have never used erlang before.<br>
I am writing couple helpers for squid proxy server as a practice task.<br>
I understood that erlang can provide concurrency options and was curios about writing a small acl helper using it.<br>
I have written example helpers in python, ruby, perl and couple other languages and I want to write one in erlang too.<br>
<br>
Since I am not familiar with the syntax I would like to get a recommendation about a brief tutorial that can help me get this specific task done.<br>
The program task is:<br>
read each line from STDIN and response accordingly to STDOUT by a procedure\function\method.<br>
<br>
In ruby, perl and python I have a method to fetch only one line from STDIN which allows me to run a couple things on this line only while the STDIN buffer receives more content.<br>
<br>
I would like to do the same using erlang.<br>
<br>
Any help will be appreciated.<br>
<br>
Thanks,<br>
Eliezer<br>
______________________________<u></u>_________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/<u></u>listinfo/erlang-questions</a><br>
</blockquote></div><br></div>