Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
Get HideMyAss! VPN, PC Mag's Top 10 VPNs of 2016 for 55% off for a Limited Time ×
User Journal

Journal Journal: Amusement, tattoos and website

Recent article on ask/. about body art and the work place. Lots of people got cranky about it apparently and accused those with body art of being freakish losers that are totally unemployable.

I mentioned this to a good friend of mine in Texas, who is a CEO. And has his entire upper body (minus face, neck and hands) covered in traditional Gaelic designs in a nice woad-blue ink. He thought the idea was funny and decided a lot of the people posting negatively are very uptight.

On another side note, from my few posts to the thread (well 6 or 7 now) I have received around 50 unique hits to my Nimheil website, including three or four people downloading tracks from it.

Tis an amusing day.

User Journal

Journal Journal: Yes, I was bored... And I don't have a HP calculator. 1

#!perl
# lets write a RPN calculator for the fun of it
#
#
my @input;
my @operators;
my $scratch;
while($read = <STDIN>)
    {
        chomp($read);
        if($read =~ /EOI/)
            {
                exit 0;
            }
        if($read =~ /\+/)
            {
                $b = pop @input;
                $a = pop @input;
                $scratch = func_addition($a, $b);
                push @input, $scratch;
            }
        elsif($read =~ /\-/)
            {
                $b = pop @input;
                $a = pop @input;
                $scratch = func_subtraction($a, $b);
                push @input, $scratch;
            }
        elsif($read =~ /\//)
            {
                $b = pop @input;
                $a = pop @input;
                $scratch = func_division($a, $b);
                push @input, $scratch;
            }
        elsif($read =~ /\*/)
            {
                $b = pop @input;
                $a = pop @input;
                $scratch = func_multiply($a, $b);
                push @input, $scratch;
            }
        else
            {
            push @input, $read;
            }
        func_printstack(@input);
    }

exit 1;

sub func_printstack(@)
    {
        my @stack = @_;

        $size = $#stack + 1;
        print "[ ";
        for ($i = 0; $i < $size ; $i++)
            {
                print "$stack[$i] ";
            }
        print " ] \n";
    }

sub func_multiply($$)
{
    my($first, $second) =@_;
    my $answer;
    $answer = $first * $second;
    return $answer;
}
sub func_addition($$)
{
    my($first, $second) =@_;
    my $answer;
    $answer = $first + $second;
    return $answer;
}
sub func_subtraction($$)
{
    my($first, $second) =@_;
    my $answer;
    $answer = $first - $second;
    return $answer;
}
sub func_division($$)
{
    my($first, $second) =@_;
    my $answer;
    if($second != 0)
        {
        $answer = $first / $second;
        }
    else
        {
        print "Division by 0 fubar\n";
        exit 1;
        }
    return $answer;
}
User Journal

Journal Journal: Oh well

I seem to have journals everywhere. Why not one place more. I prefer my one at LJ but hey. To each their own.

Slashdot Top Deals

Decaffeinated coffee? Just Say No.

Working...