use strict;
my $str = '#!/bin/bash
flavor=${1:-dzen2}
function gmail() {
while true
do
inbox_count=$(wget -q -O- --auth-no-challenge --user=something@gmail.com --password=something \'https://mail.goog$
echo "Gg:$inbox_count"
sleep 60
done
}
function weather() {
while true
do
weather_stat=$($HOME/.config/i3/./weather.sh)
echo "F$weather_stat"
sleep 900
done
}
function time_date() {
while true
do
klocka=$(date +\'%A den %d %B v%V %H:%M\')
echo "S$klocka"
sleep 10
done < <(echo)
}
bspc control --put-status
xtitle -sf "T%s" > "$PANEL_FIFO" &
weather > "$PANEL_FIFO" &
gmail > "$PANEL_FIFO" &
time_date > "$PANEL_FIFO" &
case "$flavor" in
bar)
cat "$PANEL_FIFO" | .config/bspwm/panel_bar | bar
;;
dzen2)
. .config/bspwm/panel_colors
PANEL_HEIGHT=14
FONT_FAMILY=\'Dejavu Sans\'
FONT_SIZE=9
cat "$PANEL_FIFO" | .config/bspwm/panel_dzen2 -f "$FONT_FAMILY" -s "$FONT_SIZE" | \\
dzen2 -h $PANEL_HEIGHT -dock -ta l -title-name panel -fn "${FONT_FAMILY}:pixelsize=${FONT_SIZE}" \\
-fg "$COLOR_FOREGROUND" -bg "$COLOR_BACKGROUND"
;;
esac';
my $regex = qr/^\s*(\w*)=\s?\d/mp;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html