chevron-left chevron-right

Piotr Nalepa Frontend, architecture and AI

[PERL] tablica asocjacyna przechowująca nazwy miesięcy i ilość dni w miesiącach

This version
blog.piotrnalepa.pl/2009/05/30/perl-tablica-asocjacyna-przechowujaca-nazwy-miesiecy-i-ilosc-dni-w-miesiacach
Published
Author
, Staff Software Engineer
Category
Other
Feedback
Write to me · Post on X

This post is 17 years old. Browsers and tools may have changed since then, so check the code against current documentation before you use it.

Napisz skrypt operujący na jednej tablicy asocjacyjnej przechowującej nazwy miesięcy i ilości dni w miesiącach. Kod skryptu ma wypisać nazwy i ilości dni tych miesięcy, których długość nazwy jest większa niż 6.

Example 1PERL
#!/usr/bin/perl -w
 
%miesiace = (   "Styczeń", 31,
                "Luty", 28,
                "Marzec", 31,
                "Kwiecień", 30,
                "Maj", 31,
                "Czerwiec", 30,
                "Lipiec", 31,
                "Sierpień", 31,
                "Wrzesień", 30,
                "Październik", 31,
                "Listopad", 30,
                "Grudzień", 31  );
 
while(($miesiac, $dni) = each(%miesiace))
{
  if(length($miesiac) > 6)
  {
    print $miesiac. " - liczba dni: " .$dni. "n";
  }
}
Share
Feedback

About the author

Staff Software Engineer

I've been writing this blog since 2009 and building for the web professionally for 14 years. Today I lead the frontend of the Cosmos platform at Bishop Fox, where I've been since day one of the project. Before that I worked at OLX, KUDO, Auto1 and eZ Systems. Here I write about what I've learned in practice: JavaScript, TypeScript, React, CSS and frontend architecture. I've also spoken at conferences across Poland and Europe. Got a question or an idea for a post? Let me know!