Understanding complex networks in the real world is a nontrivial task. In the study of community structures we normally encounter several examples of these networks, which makes any statistical inferencing a challenging endeavor. Researchers resort to computer-generated networks that resemble networks encountered in the real world as a means to generate many networks with different sizes, while maintaining the real-world characteristics of interest. The generation of networks that resemble the real world turns out in itself to be a complex search problem. We present a new rewiring algorithm for the generation of networks with unique characteristics that combine the scale-free effects and community structures encountered in the real world. The algorithm is inspired by social interactions in the real world, whereby people tend to connect locally while occasionally they connect globally. This local-global coupling turns out to be a powerful characteristics that is required for our proposed rewiring algorithm to generate networks with community structures, power law distributions both in degree and in community size, positive assortative mixing by degree, and the rich-club phenomenon.