পার্ল, 32 + 32 = 64
স্ট্রিংটি STDIN এ প্রত্যাশিত। আউটপুটটি STDOUT এ লেখা হয়। সাদা স্থান উপেক্ষা করা হয়। আমার কার্যটির ব্যাখ্যাটি হ'ল স্কোরটি পাওয়ার জন্য প্রোগ্রামটি নিজেই চালানো উচিত।
$/ = $,;
$_ = <>;
s x\sxxg;
$\ = length;
print s x[0-9a-z]xxgi,
' + ',
s x.xxg,
' = '
মন্তব্যে অসম্পূর্ণ
$/ = $,; # The input separator becomes undefined, because the default for $, is "undef"
$_ = <>; # now $_ takes the whole file (STDIN) instead of the first line
s x\sxxg; # $_ =~ s/\s//g;
# white space is removed from $_
$\ = length; # The number of the other characters are put into $\,
# which is automatically printed the end of "print".
print s x[0-9a-z]xxgi, # s/[0-9a-z]//gi
# Remove alphanumeric characters and return their count
' + ',
s x.xxg, # s/.//g
# Remove the remaining special characters and return their count.
# "." does not catch new lines, but we have already
# removed white spaces including new lines.
' = '
আমি একই বাইট গণনা সহ বেশ কয়েকটি প্রকরণ পেয়েছি, যেমন:
$/ = $x;
$_ = <>, s x\sxxg;
$\ = split $x;
print s x[\da-z]xxgi,
" + ",
s x.xxg,
' = '
উদাহরণ
প্রশ্ন থেকে উদাহরণ:
echo 'http://stackexchange.com' | perl a.pl
20 + 4 = 24
নিজেই চলছে ( a.pl):
cat a.pl | perl a.pl
32 + 32 = 64
ফাইলের আকার 104 বাইট, সুতরাং 40 বাইট সাদা স্থান হিসাবে অগ্রাহ্য করা হয়।
পার্ল, 29 + 29 = 58
$_=<>;s x\sxxg;$\=length;print s x[0-9a-z]xxgi,' + ',s/.//g,' = '
স্ট্রিংটি STDIN এ প্রত্যাশিত এবং এটি প্রথম লাইনে সীমাবদ্ধ। ফলাফলটি STDOUT এ মুদ্রিত হয়। সাদা স্থান উপেক্ষা করা হয়।
Ungolfed
$_ = <>;
s x\sxxg; # same as s/\s//gx; removes white space;
$\ = length($_); # sum is automatically appended at the end of print
print sx[0-9a-z]xxgi, # same as s/[0-9a-z]//gi;
# the number of alphanumeric characters
' + ',
s/.//g, # the number of the remaining special characters
' = '
উদাহরণ
ফাইলটিতে a.plপার্ল স্ক্রিপ্ট রয়েছে।
প্রশ্ন থেকে উদাহরণ:
echo 'http://stackexchange.com' | perl a.pl
20 + 4 = 24
নিজেই চলছে:
cat a.pl | perl a.pl
29 + 29 = 58
ফাইলের আকার a.pl65 বাইট, সুতরাং 7 বাইট সাদা স্থান হিসাবে অগ্রাহ্য করা হয়।
O.,O?এবংO!এবং তারপর কোনো প্রোগ্রাম আমি লিখি চরিত্র শ্রেণী সীমাবদ্ধতা পূরণ করে ... অবশ্যই এটা সম্ভবত দৈর্ঘ্য ব্যবসা হারান।