summaryrefslogtreecommitdiff
path: root/ordval.pl
diff options
context:
space:
mode:
authorstderr64 <stderr64@xservers.dy.fi>2024-04-03 00:21:12 +0300
committerstderr64 <stderr64@xservers.dy.fi>2024-04-03 00:21:12 +0300
commit953dd54bb9af12292351ead972a1e968e20593f9 (patch)
treecaa8ac31397ae45a606ee46bdd2f55e18ff3f237 /ordval.pl
downloadordval-953dd54bb9af12292351ead972a1e968e20593f9.tar.gz
ordval-953dd54bb9af12292351ead972a1e968e20593f9.tar.zst
First commitHEADmaster
Diffstat (limited to 'ordval.pl')
-rwxr-xr-xordval.pl33
1 files changed, 33 insertions, 0 deletions
diff --git a/ordval.pl b/ordval.pl
new file mode 100755
index 0000000..4e890f7
--- /dev/null
+++ b/ordval.pl
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+use POSIX;
+
+if ( length(@ARGV) <= 0 ){
+ print( "Usage: ".__FILE__." [text]\n" );
+ exit( 0 );
+}
+
+my @txt_array = split( m//, $ARGV[0] );
+if ( length(@txt_array) <= 0 ){
+ undef @txt_array;
+ print( "Error: No text given\n" );
+ exit( 0 );
+}
+
+my $arr_len = scalar(@txt_array) - 1;
+my $iter_count = 0;
+
+foreach my $arr_item (@txt_array){
+ print( ord($arr_item) );
+ if ( $iter_count < $arr_len ){
+ print( ", " );
+ }
+ $iter_count++;
+}
+
+undef $arr_len;
+undef $iter_count;
+undef @txt_array;
+
+print( "\n" );
+
+exit( 0 );